Commit cef5b63dabe69e0f15d092b20688f67f33410712
1 parent
d927c459
init: 启动项目
Showing
143 changed files
with
3325 additions
and
2499 deletions
pom.xml
... | ... | @@ -2,19 +2,17 @@ |
2 | 2 | <project xmlns="http://maven.apache.org/POM/4.0.0" |
3 | 3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
4 | 4 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
5 | - <modelVersion>4.0.0</modelVersion> | |
6 | - | |
7 | - <groupId>com.order.erp</groupId> | |
8 | - <artifactId>order-erp-services</artifactId> | |
9 | - <packaging>pom</packaging> | |
10 | - <version>1.0-SNAPSHOT</version> | |
11 | - | |
12 | 5 | <parent> |
13 | 6 | <groupId>org.springframework.boot</groupId> |
14 | 7 | <artifactId>spring-boot-starter-parent</artifactId> |
15 | 8 | <version>2.2.5.RELEASE</version> |
16 | 9 | <relativePath/> <!-- lookup parent from repository --> |
17 | 10 | </parent> |
11 | + <modelVersion>4.0.0</modelVersion> | |
12 | + | |
13 | + <groupId>com.order.erp</groupId> | |
14 | + <artifactId>order-erp</artifactId> | |
15 | + <version>1.0-SNAPSHOT</version> | |
18 | 16 | |
19 | 17 | <properties> |
20 | 18 | <maven-compiler-plugin>3.7.0</maven-compiler-plugin> |
... | ... | @@ -34,6 +32,7 @@ |
34 | 32 | <poi-ooxml.version>3.17</poi-ooxml.version> |
35 | 33 | <commons-csv.version>1.6</commons-csv.version> |
36 | 34 | <commons-lang3.version>3.8.1</commons-lang3.version> |
35 | + <commons-pool2.version>2.11.1</commons-pool2.version> | |
37 | 36 | <ip2region.version>1.7.2</ip2region.version> |
38 | 37 | <userAgentUtils.version>1.20</userAgentUtils.version> |
39 | 38 | <swagger.version>2.9.2</swagger.version> |
... | ... | @@ -45,208 +44,203 @@ |
45 | 44 | <jjwt.version>0.10.6</jjwt.version> |
46 | 45 | </properties> |
47 | 46 | |
48 | - <dependencyManagement> | |
49 | - <dependencies> | |
50 | - <dependency> | |
51 | - <groupId>org.springframework.boot</groupId> | |
52 | - <artifactId>spring-boot-starter-web</artifactId> | |
53 | - <version>2.2.5.RELEASE</version> | |
54 | - <exclusions> | |
55 | - <exclusion> | |
56 | - <groupId>org.springframework.boot</groupId> | |
57 | - <artifactId>spring-boot-starter-logging</artifactId> | |
58 | - </exclusion> | |
59 | - </exclusions> | |
60 | - </dependency> | |
47 | + <dependencies> | |
48 | + <dependency> | |
49 | + <groupId>org.springframework.boot</groupId> | |
50 | + <artifactId>spring-boot-starter-web</artifactId> | |
51 | + <version>2.2.5.RELEASE</version> | |
52 | + <exclusions> | |
53 | + <exclusion> | |
54 | + <groupId>org.springframework.boot</groupId> | |
55 | + <artifactId>spring-boot-starter-logging</artifactId> | |
56 | + </exclusion> | |
57 | + </exclusions> | |
58 | + </dependency> | |
61 | 59 | |
62 | - <!-- Lombok 依赖--> | |
63 | - <dependency> | |
64 | - <groupId>org.projectlombok</groupId> | |
65 | - <artifactId>lombok</artifactId> | |
66 | - <version>${lombok.version}</version> | |
67 | - <optional>true</optional> | |
68 | - </dependency> | |
60 | + <!-- Lombok 依赖--> | |
61 | + <dependency> | |
62 | + <groupId>org.projectlombok</groupId> | |
63 | + <artifactId>lombok</artifactId> | |
64 | + <version>${lombok.version}</version> | |
65 | + <optional>true</optional> | |
66 | + </dependency> | |
67 | + <dependency> | |
68 | + <groupId>org.springframework.boot</groupId> | |
69 | + <artifactId>spring-boot-starter-aop</artifactId> | |
70 | + <version>${springboot.version}</version> | |
71 | + </dependency> | |
72 | + <dependency> | |
73 | + <groupId>org.springframework.boot</groupId> | |
74 | + <artifactId>spring-boot-starter-test</artifactId> | |
75 | + <version>${springboot.version}</version> | |
76 | + <scope>test</scope> | |
77 | + </dependency> | |
69 | 78 | |
70 | - <dependency> | |
71 | - <groupId>org.springframework.boot</groupId> | |
72 | - <artifactId>spring-boot-starter-test</artifactId> | |
73 | - <version>${springboot.version}</version> | |
74 | - </dependency> | |
79 | + <dependency> | |
80 | + <groupId>com.baomidou</groupId> | |
81 | + <artifactId>mybatis-plus-boot-starter</artifactId> | |
82 | + <version>${baomidou.version}</version> | |
83 | + </dependency> | |
84 | + <!-- <dependency>--> | |
85 | + <!-- <groupId>com.baomidou</groupId>--> | |
86 | + <!-- <artifactId>dynamic-datasource-spring-boot-starter</artifactId>--> | |
87 | + <!-- </dependency>--> | |
88 | + <dependency> | |
89 | + <groupId>mysql</groupId> | |
90 | + <artifactId>mysql-connector-java</artifactId> | |
91 | + <version>${mysql-connector.version}</version> | |
92 | + </dependency> | |
93 | + <dependency> | |
94 | + <groupId>com.alibaba</groupId> | |
95 | + <artifactId>druid-spring-boot-starter</artifactId> | |
96 | + <version>${druid.version}</version> | |
97 | + </dependency> | |
75 | 98 | |
76 | - <dependency> | |
77 | - <groupId>com.baomidou</groupId> | |
78 | - <artifactId>mybatis-plus-boot-starter</artifactId> | |
79 | - <version>${baomidou.version}</version> | |
80 | - </dependency> | |
81 | - <dependency> | |
82 | - <groupId>cn.hutool</groupId> | |
83 | - <artifactId>hutool-crypto</artifactId> | |
84 | - <version>${hutool-crypto.version}</version> | |
85 | - </dependency> | |
86 | - <dependency> | |
87 | - <groupId>mysql</groupId> | |
88 | - <artifactId>mysql-connector-java</artifactId> | |
89 | - <version>${mysql-connector.version}</version> | |
90 | - </dependency> | |
91 | - <dependency> | |
92 | - <groupId>com.alibaba</groupId> | |
93 | - <artifactId>druid-spring-boot-starter</artifactId> | |
94 | - <version>${druid.version}</version> | |
95 | - </dependency> | |
99 | + <dependency> | |
100 | + <groupId>org.springframework.boot</groupId> | |
101 | + <artifactId>spring-boot-starter-log4j2</artifactId> | |
102 | + <version>${springboot.version}</version> | |
103 | + </dependency> | |
104 | + <dependency> | |
105 | + <groupId>org.springframework.boot</groupId> | |
106 | + <artifactId>spring-boot-starter-security</artifactId> | |
107 | + <version>${springboot.version}</version> | |
108 | + </dependency> | |
96 | 109 | |
97 | - <dependency> | |
98 | - <groupId>org.springframework.boot</groupId> | |
99 | - <artifactId>spring-boot-starter-log4j2</artifactId> | |
100 | - <version>${springboot.version}</version> | |
101 | - </dependency> | |
102 | - <dependency> | |
103 | - <groupId>org.springframework.boot</groupId> | |
104 | - <artifactId>spring-boot-starter-security</artifactId> | |
105 | - <version>${springboot.version}</version> | |
106 | - </dependency> | |
107 | - <!-- email --> | |
108 | - <dependency> | |
109 | - <groupId>org.springframework.boot</groupId> | |
110 | - <artifactId>spring-boot-starter-mail</artifactId> | |
111 | - <version>${springboot.version}</version> | |
112 | - </dependency> | |
113 | - <!-- freemarker 模版 --> | |
114 | - <dependency> | |
115 | - <groupId>org.springframework.boot</groupId> | |
116 | - <artifactId>spring-boot-starter-freemarker</artifactId> | |
117 | - <version>${springboot.version}</version> | |
118 | - </dependency> | |
119 | - <!-- aop --> | |
120 | - <dependency> | |
121 | - <groupId>org.springframework.boot</groupId> | |
122 | - <artifactId>spring-boot-starter-aop</artifactId> | |
123 | - <version>${springboot.version}</version> | |
124 | - </dependency> | |
125 | - <dependency> | |
126 | - <groupId>com.alibaba</groupId> | |
127 | - <artifactId>fastjson</artifactId> | |
128 | - <version>${fastjson.version}</version> | |
129 | - </dependency> | |
110 | + <!--jwt--> | |
111 | + <dependency> | |
112 | + <groupId>io.jsonwebtoken</groupId> | |
113 | + <artifactId>jjwt-api</artifactId> | |
114 | + <version>${jjwt.version}</version> | |
115 | + </dependency> | |
116 | + <dependency> | |
117 | + <groupId>io.jsonwebtoken</groupId> | |
118 | + <artifactId>jjwt-impl</artifactId> | |
119 | + <version>${jjwt.version}</version> | |
120 | + </dependency> | |
121 | + <dependency> | |
122 | + <groupId>io.jsonwebtoken</groupId> | |
123 | + <artifactId>jjwt-jackson</artifactId> | |
124 | + <version>${jjwt.version}</version> | |
125 | + </dependency> | |
130 | 126 | |
131 | - <dependency> | |
132 | - <groupId>org.springframework.boot</groupId> | |
133 | - <artifactId>spring-boot-starter-data-redis</artifactId> | |
134 | - <version>${springboot.version}</version> | |
135 | - </dependency> | |
136 | 127 | |
137 | - <!-- RESTful APIs swagger2 --> | |
138 | - <dependency> | |
139 | - <groupId>io.springfox</groupId> | |
140 | - <artifactId>springfox-swagger2</artifactId> | |
141 | - <version>${swagger.version}</version> | |
142 | - <exclusions> | |
143 | - <exclusion> | |
144 | - <groupId>io.swagger</groupId> | |
145 | - <artifactId>swagger-annotations</artifactId> | |
146 | - </exclusion> | |
147 | - <exclusion> | |
148 | - <groupId>io.swagger</groupId> | |
149 | - <artifactId>swagger-models</artifactId> | |
150 | - </exclusion> | |
151 | - </exclusions> | |
152 | - </dependency> | |
153 | - <dependency> | |
154 | - <groupId>io.springfox</groupId> | |
155 | - <artifactId>springfox-swagger-ui</artifactId> | |
156 | - <version>${swagger.version}</version> | |
157 | - </dependency> | |
158 | - <dependency> | |
159 | - <groupId>io.swagger</groupId> | |
160 | - <artifactId>swagger-annotations</artifactId> | |
161 | - <version>${swagger-annotations.version}</version> | |
162 | - </dependency> | |
163 | - <dependency> | |
164 | - <groupId>io.swagger</groupId> | |
165 | - <artifactId>swagger-models</artifactId> | |
166 | - <version>${swagger-models.version}</version> | |
167 | - </dependency> | |
128 | + <dependency> | |
129 | + <groupId>com.alibaba</groupId> | |
130 | + <artifactId>fastjson</artifactId> | |
131 | + <version>${fastjson.version}</version> | |
132 | + </dependency> | |
168 | 133 | |
169 | - <!--工具包--> | |
170 | - <dependency> | |
171 | - <groupId>cn.hutool</groupId> | |
172 | - <artifactId>hutool-all</artifactId> | |
173 | - <version>${hutool-all.version}</version> | |
174 | - </dependency> | |
175 | - <dependency> | |
176 | - <groupId>org.apache.poi</groupId> | |
177 | - <artifactId>poi</artifactId> | |
178 | - <version>${poi.version}</version> | |
179 | - </dependency> | |
180 | - <dependency> | |
181 | - <groupId>org.apache.poi</groupId> | |
182 | - <artifactId>poi-ooxml</artifactId> | |
183 | - <version>${poi-ooxml.version}</version> | |
184 | - </dependency> | |
185 | - <dependency> | |
186 | - <groupId>org.apache.commons</groupId> | |
187 | - <artifactId>commons-csv</artifactId> | |
188 | - <version>${commons-csv.version}</version> | |
189 | - </dependency> | |
190 | - <dependency> | |
191 | - <groupId>org.apache.commons</groupId> | |
192 | - <artifactId>commons-lang3</artifactId> | |
193 | - <version>${commons-lang3.version}</version> | |
194 | - </dependency> | |
195 | - <!--https://gitee.com/lionsoul/ip2region/tree/v1.4-release/--> | |
196 | - <dependency> | |
197 | - <groupId>org.lionsoul</groupId> | |
198 | - <artifactId>ip2region</artifactId> | |
199 | - <version>${ip2region.version}</version> | |
200 | - </dependency> | |
201 | - <dependency> | |
202 | - <groupId>eu.bitwalker</groupId> | |
203 | - <artifactId>UserAgentUtils</artifactId> | |
204 | - <version>${userAgentUtils.version}</version> | |
205 | - </dependency> | |
206 | - <dependency> | |
207 | - <groupId>joda-time</groupId> | |
208 | - <artifactId>joda-time</artifactId> | |
209 | - <version>${joda-time.version}</version> | |
210 | - </dependency> | |
211 | - <dependency> | |
212 | - <groupId>com.google.guava</groupId> | |
213 | - <artifactId>guava</artifactId> | |
214 | - <version>${guava.version}</version> | |
215 | - </dependency> | |
134 | + <dependency> | |
135 | + <groupId>cn.hutool</groupId> | |
136 | + <artifactId>hutool-crypto</artifactId> | |
137 | + <version>${hutool-crypto.version}</version> | |
138 | + </dependency> | |
216 | 139 | |
217 | - <dependency> | |
218 | - <groupId>com.github.whvcse</groupId> | |
219 | - <artifactId>easy-captcha</artifactId> | |
220 | - <version>${easy-captcha.version}</version> | |
221 | - </dependency> | |
140 | + <dependency> | |
141 | + <groupId>org.springframework.boot</groupId> | |
142 | + <artifactId>spring-boot-starter-data-redis</artifactId> | |
143 | + <version>${springboot.version}</version> | |
144 | + </dependency> | |
222 | 145 | |
223 | - <!--短信服务--> | |
224 | - <dependency> | |
225 | - <groupId>com.aliyun</groupId> | |
226 | - <artifactId>aliyun-java-sdk-core</artifactId> | |
227 | - <version>${aliyun-java-sdk-core.version}</version> | |
228 | - </dependency> | |
146 | + <dependency> | |
147 | + <groupId>org.apache.commons</groupId> | |
148 | + <artifactId>commons-pool2</artifactId> | |
149 | + <version>${commons-pool2.version}</version> | |
150 | + </dependency> | |
229 | 151 | |
230 | - <!--jwt--> | |
231 | - <dependency> | |
232 | - <groupId>io.jsonwebtoken</groupId> | |
233 | - <artifactId>jjwt-api</artifactId> | |
234 | - <version>${jjwt.version}</version> | |
235 | - </dependency> | |
236 | - <dependency> | |
237 | - <groupId>io.jsonwebtoken</groupId> | |
238 | - <artifactId>jjwt-impl</artifactId> | |
239 | - <version>${jjwt.version}</version> | |
240 | - </dependency> | |
241 | - <dependency> | |
242 | - <groupId>io.jsonwebtoken</groupId> | |
243 | - <artifactId>jjwt-jackson</artifactId> | |
244 | - <version>${jjwt.version}</version> | |
245 | - </dependency> | |
246 | 152 | |
247 | - </dependencies> | |
248 | - </dependencyManagement> | |
153 | + <dependency> | |
154 | + <groupId>org.apache.commons</groupId> | |
155 | + <artifactId>commons-lang3</artifactId> | |
156 | + <version>${commons-lang3.version}</version> | |
157 | + </dependency> | |
158 | + <dependency> | |
159 | + <groupId>org.lionsoul</groupId> | |
160 | + <artifactId>ip2region</artifactId> | |
161 | + <version>${ip2region.version}</version> | |
162 | + </dependency> | |
163 | + <dependency> | |
164 | + <groupId>eu.bitwalker</groupId> | |
165 | + <artifactId>UserAgentUtils</artifactId> | |
166 | + <version>${userAgentUtils.version}</version> | |
167 | + </dependency> | |
168 | + <!-- RESTful APIs swagger2 --> | |
169 | + <dependency> | |
170 | + <groupId>io.springfox</groupId> | |
171 | + <artifactId>springfox-swagger2</artifactId> | |
172 | + <version>${swagger.version}</version> | |
173 | + <exclusions> | |
174 | + <exclusion> | |
175 | + <groupId>io.swagger</groupId> | |
176 | + <artifactId>swagger-annotations</artifactId> | |
177 | + </exclusion> | |
178 | + <exclusion> | |
179 | + <groupId>io.swagger</groupId> | |
180 | + <artifactId>swagger-models</artifactId> | |
181 | + </exclusion> | |
182 | + </exclusions> | |
183 | + </dependency> | |
184 | + <dependency> | |
185 | + <groupId>io.springfox</groupId> | |
186 | + <artifactId>springfox-swagger-ui</artifactId> | |
187 | + <version>${swagger.version}</version> | |
188 | + </dependency> | |
189 | + <dependency> | |
190 | + <groupId>io.swagger</groupId> | |
191 | + <artifactId>swagger-annotations</artifactId> | |
192 | + <version>${swagger-annotations.version}</version> | |
193 | + </dependency> | |
194 | + <dependency> | |
195 | + <groupId>io.swagger</groupId> | |
196 | + <artifactId>swagger-models</artifactId> | |
197 | + <version>${swagger-models.version}</version> | |
198 | + </dependency> | |
199 | + <!--工具包--> | |
200 | + <dependency> | |
201 | + <groupId>cn.hutool</groupId> | |
202 | + <artifactId>hutool-all</artifactId> | |
203 | + <version>${hutool-all.version}</version> | |
204 | + </dependency> | |
205 | + <dependency> | |
206 | + <groupId>org.apache.poi</groupId> | |
207 | + <artifactId>poi</artifactId> | |
208 | + <version>${poi.version}</version> | |
209 | + </dependency> | |
210 | + <dependency> | |
211 | + <groupId>org.apache.poi</groupId> | |
212 | + <artifactId>poi-ooxml</artifactId> | |
213 | + <version>${poi-ooxml.version}</version> | |
214 | + </dependency> | |
215 | + <dependency> | |
216 | + <groupId>org.apache.commons</groupId> | |
217 | + <artifactId>commons-csv</artifactId> | |
218 | + <version>${commons-csv.version}</version> | |
219 | + </dependency> | |
220 | + <dependency> | |
221 | + <groupId>joda-time</groupId> | |
222 | + <artifactId>joda-time</artifactId> | |
223 | + <version>${joda-time.version}</version> | |
224 | + </dependency> | |
225 | + <dependency> | |
226 | + <groupId>com.google.guava</groupId> | |
227 | + <artifactId>guava</artifactId> | |
228 | + <version>${guava.version}</version> | |
229 | + </dependency> | |
249 | 230 | |
231 | + <dependency> | |
232 | + <groupId>com.github.whvcse</groupId> | |
233 | + <artifactId>easy-captcha</artifactId> | |
234 | + <version>${easy-captcha.version}</version> | |
235 | + </dependency> | |
236 | + | |
237 | + <!--短信服务--> | |
238 | + <dependency> | |
239 | + <groupId>com.aliyun</groupId> | |
240 | + <artifactId>aliyun-java-sdk-core</artifactId> | |
241 | + <version>${aliyun-java-sdk-core.version}</version> | |
242 | + </dependency> | |
243 | + </dependencies> | |
250 | 244 | <build> |
251 | 245 | <finalName>order-erp.service-1.0-SNAPSHOT</finalName> |
252 | 246 | <plugins> |
... | ... | @@ -265,5 +259,4 @@ |
265 | 259 | |
266 | 260 | </plugins> |
267 | 261 | </build> |
268 | - | |
269 | 262 | </project> |
270 | 263 | \ No newline at end of file | ... | ... |
sql/init.sql
0 → 100644
1 | +# 部门表 | |
2 | +CREATE TABLE `admin_dept` ( | |
3 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
4 | + `pid` bigint(20) DEFAULT NULL COMMENT '上级部门', | |
5 | + `sub_count` int(5) DEFAULT '0' COMMENT '子部门数目', | |
6 | + `name` varchar(255) NOT NULL COMMENT '名称', | |
7 | + `dept_sort` int(5) DEFAULT '999' COMMENT '排序', | |
8 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
9 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
10 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
11 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
12 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
13 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
14 | + PRIMARY KEY (`id`) | |
15 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='部门表'; | |
16 | + | |
17 | + | |
18 | +# 岗位表 | |
19 | +CREATE TABLE `admin_job` ( | |
20 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
21 | + `name` varchar(64) NOT NULL COMMENT '岗位名称', | |
22 | + `sort` INT NOT NULL COMMENT '排序字段', | |
23 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
24 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
25 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
26 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
27 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
28 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
29 | + PRIMARY KEY (`id`) | |
30 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='岗位表'; | |
31 | + | |
32 | + | |
33 | +# 菜单表 | |
34 | +CREATE TABLE `admin_menu` ( | |
35 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
36 | + `pid` bigint(20) DEFAULT NULL COMMENT '上级菜单ID', | |
37 | + `sub_count` int(5) DEFAULT '0' COMMENT '子菜单数目', | |
38 | + `type` int(11) DEFAULT NULL COMMENT '菜单类型', | |
39 | + `title` varchar(255) DEFAULT NULL COMMENT '菜单标题', | |
40 | + `name` varchar(255) DEFAULT NULL COMMENT '组件名称', | |
41 | + `component` varchar(255) DEFAULT NULL COMMENT '组件', | |
42 | + `menu_sort` int(5) DEFAULT NULL COMMENT '排序', | |
43 | + `icon` varchar(255) DEFAULT NULL COMMENT '图标', | |
44 | + `path` varchar(255) DEFAULT NULL COMMENT '链接地址', | |
45 | + `i_frame` bit(1) DEFAULT NULL COMMENT '是否外链', | |
46 | + `cache` bit(1) DEFAULT b'0' COMMENT '缓存', | |
47 | + `hidden` bit(1) DEFAULT b'0' COMMENT '隐藏', | |
48 | + `permission` varchar(255) DEFAULT NULL COMMENT '权限', | |
49 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
50 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
51 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
52 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
53 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
54 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
55 | + PRIMARY KEY (`menu_id`) USING BTREE, | |
56 | + UNIQUE KEY `uniq_title` (`title`), | |
57 | + UNIQUE KEY `uniq_name` (`name`), | |
58 | + KEY `inx_pid` (`pid`) | |
59 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; | |
60 | + | |
61 | + | |
62 | +# 角色表 | |
63 | +CREATE TABLE `admin_role` ( | |
64 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
65 | + `name` varchar(255) NOT NULL COMMENT '名称', | |
66 | + `level` int(255) DEFAULT NULL COMMENT '角色级别', | |
67 | + `description` varchar(255) DEFAULT NULL COMMENT '描述', | |
68 | + `data_scope` varchar(255) DEFAULT NULL COMMENT '数据权限', | |
69 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
70 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
71 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
72 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
73 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
74 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
75 | + PRIMARY KEY (`id`) | |
76 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色表'; | |
77 | + | |
78 | + | |
79 | +# 角色-部门表 | |
80 | +CREATE TABLE `admin_role_dept` ( | |
81 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
82 | + `role_id` bigint NOT NULL COMMENT '角色id', | |
83 | + `dept_id` bigint NOT NULL COMMENT '部门id', | |
84 | + UNIQUE KEY (`role_id`,`dept_id`) | |
85 | + PRIMARY KEY (`id`) | |
86 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-部门表'; | |
87 | + | |
88 | + | |
89 | +# 角色-菜单表 | |
90 | +CREATE TABLE `admin_role_menu` ( | |
91 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
92 | + `role_id` bigint NOT NULL COMMENT '角色id', | |
93 | + `menu_id` bigint NOT NULL COMMENT '菜单id', | |
94 | + UNIQUE KEY (`role_id`,`menu_id`) | |
95 | + PRIMARY KEY (`id`) | |
96 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='角色-菜单表'; | |
97 | + | |
98 | + | |
99 | +# 用户表 | |
100 | +CREATE TABLE `admin_user` ( | |
101 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
102 | + `dept_id` bigint(20) DEFAULT NULL COMMENT '部门名称', | |
103 | + `user_name` varchar(255) DEFAULT NULL COMMENT '用户名', | |
104 | + `nick_name` varchar(255) DEFAULT NULL COMMENT '昵称', | |
105 | + `gender` varchar(2) DEFAULT NULL COMMENT '性别', | |
106 | + `phone` varchar(255) DEFAULT NULL COMMENT '手机号码', | |
107 | + `email` varchar(255) DEFAULT NULL COMMENT '邮箱', | |
108 | + `avatar_name` varchar(255) DEFAULT NULL COMMENT '头像地址', | |
109 | + `avatar_path` varchar(255) DEFAULT NULL COMMENT '头像真实路径', | |
110 | + `password` varchar(255) DEFAULT NULL COMMENT '密码', | |
111 | + `is_admin` bit(1) DEFAULT b'0' COMMENT '是否为admin账号', | |
112 | + `pwd_reset_time` DATETIME DEFAULT NULL COMMENT '修改密码的时间', | |
113 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
114 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
115 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
116 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
117 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
118 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
119 | + UNIQUE KEY `uniq_username` (`username`), | |
120 | + UNIQUE KEY `uniq_phone` (`phone`), | |
121 | + UNIQUE KEY `uniq_email` (`email`), | |
122 | + PRIMARY KEY (`id`) | |
123 | + | |
124 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表'; | |
125 | + | |
126 | + | |
127 | +# 用户-岗位表 | |
128 | +CREATE TABLE `admin_user_job` ( | |
129 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
130 | + `user_id` bigint(20) NOT NULL COMMENT '用户ID', | |
131 | + `job_id` bigint(20) NOT NULL COMMENT '岗位ID', | |
132 | + UNIQUE KEY (`user_id`,`job_id`) | |
133 | + PRIMARY KEY (`id`) | |
134 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户-岗位表'; | |
135 | + | |
136 | + | |
137 | +# 用户角色表 | |
138 | +CREATE TABLE `admin_user_role` ( | |
139 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
140 | + `user_id` bigint NOT NULL COMMENT '用户id', | |
141 | + `role_id` bigint NOT NULL COMMENT '角色id', | |
142 | + UNIQUE KEY (`user_id`,`role_id`) | |
143 | + PRIMARY KEY (`id`) | |
144 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户角色表'; | |
145 | + | |
146 | + | |
147 | +# 字典表 | |
148 | +CREATE TABLE `dictionary` ( | |
149 | + `id` bigint NOT NULL AUTO_INCREMENT, | |
150 | + `dict_code` varchar(64) not NULL COMMENT '字典编码', | |
151 | + `dict_name` varchar(64) not null COMMENT '名称', | |
152 | + `dict_value` varchar(64) not null COMMENT '值', | |
153 | + `remark` varchar(64) default null COMMENT '备注', | |
154 | + `sort` INT default 0 COMMENT '排序字段', | |
155 | + `enable_flag` INT NOT NULL COMMENT '是否可用 10-可用 20-删除', | |
156 | + `create_time` DATETIME NOT NULL COMMENT '创建时间', | |
157 | + `create_by` varchar(64) NOT NULL COMMENT '创建人', | |
158 | + `modify_time` DATETIME DEFAULT NULL COMMENT '修改时间', | |
159 | + `modify_by` varchar(64) DEFAULT NULL COMMENT '修改人', | |
160 | + `version` INT DEFAULT NULL COMMENT '版本号--乐观锁预留字段', | |
161 | + PRIMARY KEY (`id`) | |
162 | +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='字典表'; | |
0 | 163 | \ No newline at end of file | ... | ... |
src/main/java/com/order/erp/AdminApplication.java
... | ... | @@ -3,8 +3,8 @@ package com.order.erp; |
3 | 3 | import com.baomidou.mybatisplus.annotation.DbType; |
4 | 4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
5 | 5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
6 | -import com.canrd.shop.common.directory.Path; | |
7 | -import com.canrd.shop.common.utils.SpringContextHolder; | |
6 | +import com.order.erp.common.directory.Path; | |
7 | +import com.order.erp.common.utils.SpringContextHolder; | |
8 | 8 | import org.mybatis.spring.annotation.MapperScan; |
9 | 9 | import org.springframework.boot.SpringApplication; |
10 | 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
... | ... | @@ -20,8 +20,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
20 | 20 | * @version: 1.0 |
21 | 21 | */ |
22 | 22 | @EnableAsync |
23 | -@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.canrd.shop"}) | |
24 | -@MapperScan("com.canrd.shop.**.mapper") | |
23 | +@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.order.erp"}) | |
24 | +@MapperScan("com.order.erp.**.mapper") | |
25 | 25 | @EnableTransactionManagement |
26 | 26 | public class AdminApplication { |
27 | 27 | ... | ... |
src/main/java/com/order/erp/common/constant/ServerResult.java
... | ... | @@ -18,11 +18,11 @@ public class ServerResult<T> implements Serializable { |
18 | 18 | /** |
19 | 19 | * 返回的状态码 |
20 | 20 | */ |
21 | - private int result = ServerResultCode.SUCCESS.getErrorCode(); | |
21 | + private int result = com.canrd.shop.common.constant.ServerResultCode.SUCCESS.getErrorCode(); | |
22 | 22 | /** |
23 | 23 | * 返回的消息 |
24 | 24 | */ |
25 | - private String message = ServerResultCode.SUCCESS.getErrorDesc(); | |
25 | + private String message = com.canrd.shop.common.constant.ServerResultCode.SUCCESS.getErrorDesc(); | |
26 | 26 | /** |
27 | 27 | * 返回的数据实体 |
28 | 28 | */ |
... | ... | @@ -56,7 +56,7 @@ public class ServerResult<T> implements Serializable { |
56 | 56 | return this; |
57 | 57 | } |
58 | 58 | |
59 | - public ServerResult setResult(ServerResultCode serverResultCode) { | |
59 | + public ServerResult setResult(com.canrd.shop.common.constant.ServerResultCode serverResultCode) { | |
60 | 60 | this.result = serverResultCode.getErrorCode(); |
61 | 61 | this.message = serverResultCode.getErrorDesc(); |
62 | 62 | return this; |
... | ... | @@ -88,21 +88,21 @@ public class ServerResult<T> implements Serializable { |
88 | 88 | |
89 | 89 | public static <T> ServerResult<T> success() { |
90 | 90 | return new ServerResult() |
91 | - .setResult(ServerResultCode.SUCCESS) | |
92 | - .setMessage(ServerResultCode.SUCCESS.getErrorDesc()) | |
93 | - .setData(defaultResult(ServerResultCode.SUCCESS)); | |
91 | + .setResult(com.canrd.shop.common.constant.ServerResultCode.SUCCESS) | |
92 | + .setMessage(com.canrd.shop.common.constant.ServerResultCode.SUCCESS.getErrorDesc()) | |
93 | + .setData(defaultResult(com.canrd.shop.common.constant.ServerResultCode.SUCCESS)); | |
94 | 94 | } |
95 | 95 | |
96 | 96 | public static <T> ServerResult<T> success(T data) { |
97 | 97 | return new ServerResult() |
98 | - .setResult(ServerResultCode.SUCCESS) | |
99 | - .setMessage(ServerResultCode.SUCCESS.getErrorDesc()) | |
98 | + .setResult(com.canrd.shop.common.constant.ServerResultCode.SUCCESS) | |
99 | + .setMessage(com.canrd.shop.common.constant.ServerResultCode.SUCCESS.getErrorDesc()) | |
100 | 100 | .setData(data); |
101 | 101 | } |
102 | 102 | |
103 | 103 | public static <T> ServerResult<T> success(T data, String message) { |
104 | 104 | return new ServerResult() |
105 | - .setResult(ServerResultCode.SUCCESS) | |
105 | + .setResult(com.canrd.shop.common.constant.ServerResultCode.SUCCESS) | |
106 | 106 | .setMessage(message) |
107 | 107 | .setData(data); |
108 | 108 | } |
... | ... | @@ -114,7 +114,7 @@ public class ServerResult<T> implements Serializable { |
114 | 114 | */ |
115 | 115 | public static <T> ServerResult<T> fail(String message) { |
116 | 116 | return new ServerResult() |
117 | - .setResult(ServerResultCode.FAIL) | |
117 | + .setResult(com.canrd.shop.common.constant.ServerResultCode.FAIL) | |
118 | 118 | .setMessage(message) |
119 | 119 | .setData(defaultResult(Constant.RESULT_FAIL)); |
120 | 120 | } |
... | ... | @@ -126,7 +126,7 @@ public class ServerResult<T> implements Serializable { |
126 | 126 | * @param <T> |
127 | 127 | * @return |
128 | 128 | */ |
129 | - public static <T> ServerResult<T> fail(T data, ServerResultCode serverResultCode) { | |
129 | + public static <T> ServerResult<T> fail(T data, com.canrd.shop.common.constant.ServerResultCode serverResultCode) { | |
130 | 130 | return new ServerResult() |
131 | 131 | .setData(data) |
132 | 132 | .setResult(serverResultCode) |
... | ... | @@ -152,7 +152,7 @@ public class ServerResult<T> implements Serializable { |
152 | 152 | * @author dengbin |
153 | 153 | * @date 2020/9/12 |
154 | 154 | */ |
155 | - public static <T> ServerResult<T> fail(ServerResultCode serverResultCode, String msg) { | |
155 | + public static <T> ServerResult<T> fail(com.canrd.shop.common.constant.ServerResultCode serverResultCode, String msg) { | |
156 | 156 | return new ServerResult() |
157 | 157 | .setResult(serverResultCode) |
158 | 158 | .setMessage(msg) |
... | ... | @@ -165,7 +165,7 @@ public class ServerResult<T> implements Serializable { |
165 | 165 | * @author dengbin |
166 | 166 | * @date 2020/9/12 |
167 | 167 | */ |
168 | - public static <T> ServerResult<T> fail(ServerResultCode serverResultCode) { | |
168 | + public static <T> ServerResult<T> fail(com.canrd.shop.common.constant.ServerResultCode serverResultCode) { | |
169 | 169 | return new ServerResult() |
170 | 170 | .setResult(serverResultCode) |
171 | 171 | .setMessage(serverResultCode.getErrorDesc()) |
... | ... | @@ -188,8 +188,8 @@ public class ServerResult<T> implements Serializable { |
188 | 188 | |
189 | 189 | public static <T> ServerResult<T> fail() { |
190 | 190 | return new ServerResult() |
191 | - .setResult(ServerResultCode.FAIL.getErrorCode()) | |
192 | - .setMessage(ServerResultCode.FAIL.getErrorDesc()) | |
191 | + .setResult(com.canrd.shop.common.constant.ServerResultCode.FAIL.getErrorCode()) | |
192 | + .setMessage(com.canrd.shop.common.constant.ServerResultCode.FAIL.getErrorDesc()) | |
193 | 193 | .setData(defaultResult(Constant.RESULT_FAIL)); |
194 | 194 | } |
195 | 195 | |
... | ... | @@ -199,7 +199,7 @@ public class ServerResult<T> implements Serializable { |
199 | 199 | * @author dengbin |
200 | 200 | * @date 2020/9/12 |
201 | 201 | */ |
202 | - public ServerResult failEnum(ServerResultCode serverResultCode) { | |
202 | + public ServerResult failEnum(com.canrd.shop.common.constant.ServerResultCode serverResultCode) { | |
203 | 203 | setResult(serverResultCode); |
204 | 204 | setMessage(serverResultCode.getErrorDesc()); |
205 | 205 | return this; |
... | ... | @@ -218,7 +218,7 @@ public class ServerResult<T> implements Serializable { |
218 | 218 | * @return 结果 ture or false |
219 | 219 | */ |
220 | 220 | public boolean checkSuccess() { |
221 | - return result == ServerResultCode.SUCCESS.getErrorCode(); | |
221 | + return result == com.canrd.shop.common.constant.ServerResultCode.SUCCESS.getErrorCode(); | |
222 | 222 | } |
223 | 223 | |
224 | 224 | public boolean checkNotSuccess() { | ... | ... |
src/main/java/com/order/erp/common/constant/ServerResultCode.java
1 | -package com.order.erp.common.constant; | |
1 | +package com.canrd.shop.common.constant; | |
2 | 2 | |
3 | 3 | |
4 | -import com.canrd.shop.common.exception.ErrorInfo; | |
4 | +import com.order.erp.common.exception.ErrorInfo; | |
5 | 5 | import lombok.Setter; |
6 | 6 | |
7 | 7 | |
... | ... | @@ -14,6 +14,8 @@ public enum ServerResultCode implements ErrorInfo { |
14 | 14 | FAIL(1000, "系统内部错误,请联系业务系统运维管理员"), |
15 | 15 | FIlE_UPLOAD_TOO_LARGE(1051, "上传文件太大,图片文件一般小于2兆"), |
16 | 16 | |
17 | + UNAUTHORIZED(401, "登录状态过期"), | |
18 | + | |
17 | 19 | //空指针异常 |
18 | 20 | NULL_POINT(1001, "空指针异常"), |
19 | 21 | |
... | ... | @@ -24,6 +26,10 @@ public enum ServerResultCode implements ErrorInfo { |
24 | 26 | PARAM_ERROR(1005, "入参为空"), |
25 | 27 | EMPTY_RESULT(1006, "数据不存在"), |
26 | 28 | EMPTY_LIST(1007, "查询结果为空"), |
29 | + IMG_CAPTCHA_ERROR(1008, "图片验证码错误"), | |
30 | + IMG_CAPTCHA_EXPIRE_ERROR(1009, "图片验证码不存在或已过期"), | |
31 | + SMS_CAPTCHA_ERROR(1010, "短信验证码错误"), | |
32 | + SMS_CAPTCHA_EXPIRE_ERROR(1011, "短信验证码不存在或已过期"), | |
27 | 33 | |
28 | 34 | //认证授权异常 |
29 | 35 | UNAUTHENTICATION(401, "未登录"), |
... | ... | @@ -31,10 +37,28 @@ public enum ServerResultCode implements ErrorInfo { |
31 | 37 | |
32 | 38 | //用户 |
33 | 39 | USER_NOT_EXIT(20001, "用户不存在"), |
40 | + USER_UN_ENABLE(20002, "用户未激活"), | |
34 | 41 | |
35 | 42 | |
36 | 43 | // 公司 |
37 | 44 | COMPANY_NOT_EXIT(30001, "公司不存在"), |
45 | + | |
46 | + // 短信 | |
47 | + SMS_SEND_OVER_LIMIT_ERROR(40001, "发送频次过高,请一分钟后再发送"), | |
48 | + EMAIL_SEND_OVER_LIMIT_ERROR(40002, "发送频次过高(一天最多修改三次),请第二天后再发送"), | |
49 | + | |
50 | + // 会员 | |
51 | + MEMBER_PHONE_REGISTER_ERROR(50001, "手机已经被注册使用!"), | |
52 | + MEMBER_AGREE_AGREEMENT_CHOOSE_ERROR(50002, "必须同意注册协议才可进行注册操作!"), | |
53 | + MEMBER_CONFIRM_PASSWORD_ERROR(50003, "两次密码输入不一致!"), | |
54 | + MEMBER_LOGIN_PHONE_ERROR(50004, "手机号没有注册,请注册后登录!"), | |
55 | + MEMBER_LOGIN_LOCKED_TIME_ERROR(50005, "账号被锁定,请稍后再试试!"), | |
56 | + MEMBER_RECOVER_PASSWORD_ERROR(50006, "对不起,此密码找回链接已失效!"), | |
57 | + MEMBER_RECOVER_PASSWORD_EXPIRE_ERROR(50007, "对不起,此密码找回链接已过期!"), | |
58 | + | |
59 | + //产品 | |
60 | + PRODUCT_NOT_EXIST_ERROR(60001, "此商品已下架!"), | |
61 | + PRODUCT_NOT_MORE_STORE_ERROR(60002, "添加购物车失败,商品库存不足!"), | |
38 | 62 | ; |
39 | 63 | |
40 | 64 | ... | ... |
src/main/java/com/order/erp/common/directory/Path.java
src/main/java/com/order/erp/common/exception/BusinessException.java
1 | 1 | package com.order.erp.common.exception; |
2 | 2 | |
3 | -import com.canrd.shop.common.constant.ServerResult; | |
4 | 3 | import com.canrd.shop.common.constant.ServerResultCode; |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | 5 | import lombok.Getter; |
6 | 6 | import lombok.Setter; |
7 | 7 | import lombok.extern.slf4j.Slf4j; | ... | ... |
src/main/java/com/order/erp/common/exception/BusinessExceptionHandlerAdvice.java
1 | 1 | package com.order.erp.common.exception; |
2 | 2 | |
3 | -import com.canrd.shop.common.constant.ServerResult; | |
4 | 3 | import com.canrd.shop.common.constant.ServerResultCode; |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | 5 | import org.springframework.core.annotation.Order; |
6 | 6 | import org.springframework.http.HttpStatus; |
7 | 7 | import org.springframework.http.ResponseEntity; | ... | ... |
src/main/java/com/order/erp/common/exception/handler/GlobalExceptionHandler.java
1 | 1 | package com.order.erp.common.exception.handler; |
2 | 2 | |
3 | 3 | |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | 4 | import com.canrd.shop.common.constant.ServerResultCode; |
6 | -import com.canrd.shop.common.exception.BadRequestException; | |
7 | -import com.canrd.shop.common.exception.BusinessException; | |
8 | -import com.canrd.shop.common.exception.EntityExistException; | |
9 | -import com.canrd.shop.common.exception.EntityNotFoundException; | |
10 | -import com.canrd.shop.common.utils.ThrowableUtil; | |
5 | +import com.order.erp.common.constant.ServerResult; | |
6 | +import com.order.erp.common.exception.BusinessException; | |
7 | +import com.order.erp.common.exception.EntityExistException; | |
8 | +import com.order.erp.common.exception.EntityNotFoundException; | |
9 | +import com.order.erp.common.utils.ThrowableUtil; | |
11 | 10 | import lombok.extern.slf4j.Slf4j; |
12 | 11 | import org.springframework.http.HttpStatus; |
13 | 12 | import org.springframework.http.ResponseEntity; |
... | ... | @@ -72,11 +71,11 @@ public class GlobalExceptionHandler { |
72 | 71 | * @param e |
73 | 72 | * @return |
74 | 73 | */ |
75 | - @ExceptionHandler(value = BadRequestException.class) | |
76 | - public ResponseEntity<ServerResult> badRequestException(BadRequestException e) { | |
74 | + @ExceptionHandler(value = BusinessException.class) | |
75 | + public ResponseEntity<ServerResult> badRequestException(BusinessException e) { | |
77 | 76 | // 打印堆栈信息 |
78 | 77 | log.error(ThrowableUtil.getStackTrace(e)); |
79 | - return buildResponseEntity(ServerResult.fail(e.getStatus(), e.getMessage())); | |
78 | + return buildResponseEntity(ServerResult.fail(e.getErrorCode(), e.getMessage())); | |
80 | 79 | } |
81 | 80 | |
82 | 81 | /** | ... | ... |
src/main/java/com/order/erp/common/jsr303/ListValueConstraintValidator.java
src/main/java/com/order/erp/common/jsr303/annotation/ListIntValue.java
1 | 1 | package com.order.erp.common.jsr303.annotation; |
2 | 2 | |
3 | 3 | |
4 | -import com.canrd.shop.common.jsr303.ListValueConstraintValidator; | |
4 | +import com.order.erp.common.jsr303.ListValueConstraintValidator; | |
5 | 5 | |
6 | 6 | import javax.validation.Constraint; |
7 | 7 | import javax.validation.Payload; |
8 | 8 | import java.lang.annotation.*; |
9 | 9 | |
10 | 10 | /** |
11 | - * @author fanzhenyu | |
12 | 11 | * @date 2023-01-15 |
13 | 12 | */ |
14 | 13 | @Constraint(validatedBy = {ListValueConstraintValidator.class}) | ... | ... |
src/main/java/com/order/erp/common/utils/DateUtils.java
0 → 100644
1 | +package com.order.erp.common.utils; | |
2 | + | |
3 | + | |
4 | +import java.text.DateFormat; | |
5 | +import java.text.ParseException; | |
6 | +import java.text.SimpleDateFormat; | |
7 | +import java.time.*; | |
8 | +import java.time.format.DateTimeFormatter; | |
9 | +import java.time.temporal.ChronoField; | |
10 | +import java.time.temporal.TemporalAdjusters; | |
11 | +import java.util.Date; | |
12 | +import java.util.Locale; | |
13 | +import java.util.TimeZone; | |
14 | + | |
15 | +/** | |
16 | + * @Auther: dengbin | |
17 | + * @Date: 2020/9/1 | |
18 | + * 基于Java8的时间工具类 | |
19 | + */ | |
20 | +public class DateUtils { | |
21 | + /** | |
22 | + * 例如:2018-12-28 | |
23 | + */ | |
24 | + public static final String DATE = "yyyy-MM-dd"; | |
25 | + /** | |
26 | + * 例如:2018.12.28 | |
27 | + */ | |
28 | + public static final String DATE_WITH_POINT = "yyyy.MM.dd"; | |
29 | + /** | |
30 | + * 例如:2018-12-28 10:00:00 | |
31 | + */ | |
32 | + public static final String DATE_TIME = "yyyy-MM-dd HH:mm:ss"; | |
33 | + /** | |
34 | + * 例如:2018-12-28 10:00:00:215 | |
35 | + */ | |
36 | + public static final String DATE_TIME_MS = "yyyy-MM-dd HH:mm:ss.SSS"; | |
37 | + /** | |
38 | + * 例如:10:00:00 | |
39 | + */ | |
40 | + public static final String TIME = "HHmmss"; | |
41 | + /** | |
42 | + * 例如:10:00:00 | |
43 | + */ | |
44 | + public static final String TIME_HAVE_SECOND = "HH:mm:ss"; | |
45 | + /** | |
46 | + * 例如:10:00 | |
47 | + */ | |
48 | + public static final String TIME_WITHOUT_SECOND = "HH:mm"; | |
49 | + | |
50 | + /** | |
51 | + * 例如:2018-12-28 10:00 | |
52 | + */ | |
53 | + public static final String DATE_TIME_WITHOUT_SECONDS = "yyyy-MM-dd HH:mm"; | |
54 | + | |
55 | + /** | |
56 | + * 例如 2020/04/16 12:23:0 | |
57 | + */ | |
58 | + public static final String DATE_TIME_WITHOUT_SECONDS_OTHER = "yyyy/MM/dd HH:mm:ss"; | |
59 | + | |
60 | + /** | |
61 | + * 例如:2020年04月23日 10:00 | |
62 | + */ | |
63 | + public static final String DATE_CHINESE_TIME = "yyyy年MM月dd日 HH:mm"; | |
64 | + | |
65 | + /** | |
66 | + * 例如:20181228100000215 | |
67 | + */ | |
68 | + public static final String MAX_DATE = "9999-12-31 59:59:59"; | |
69 | + | |
70 | + /** | |
71 | + * 例如:20210822082134 | |
72 | + */ | |
73 | + public static final String DATE_TIME_HMS = "yyyyMMddHHmmssSSS"; | |
74 | + | |
75 | + public static final String YYMMDD = "yyyyMMdd"; | |
76 | + | |
77 | + public static final String YMMDD = "yyMMdd"; | |
78 | + | |
79 | + public static final String YYMMDDHHMMSS = "yyMMddHHmmss"; | |
80 | + | |
81 | + public static final String MONTH_TIME = "MM-dd HH:mm:ss"; | |
82 | + | |
83 | + public static LocalDateTime getCurrentTime() { | |
84 | + LocalDateTime now = LocalDateTime.now(); | |
85 | + return now; | |
86 | + } | |
87 | + | |
88 | + public static Date getNextDay() { | |
89 | + LocalDateTime now = LocalDateTime.now(); | |
90 | + LocalDateTime tomorrow = now.minusDays(-1); | |
91 | + return Date.from(tomorrow.atZone(ZoneId.systemDefault()).toInstant()); | |
92 | + } | |
93 | + | |
94 | + public static Date getAppointDay(Integer count) { | |
95 | + LocalDateTime now = LocalDateTime.now(); | |
96 | + LocalDateTime tomorrow = now.minusDays(count); | |
97 | + return Date.from(tomorrow.atZone(ZoneId.systemDefault()).toInstant()); | |
98 | + } | |
99 | + | |
100 | + /** | |
101 | + * 获取年 | |
102 | + * | |
103 | + * @return 年 | |
104 | + */ | |
105 | + public static int getYear() { | |
106 | + LocalDateTime localDateTime = LocalDateTime.now(); | |
107 | + return localDateTime.get(ChronoField.YEAR); | |
108 | + } | |
109 | + | |
110 | + /** | |
111 | + * 获取月份 | |
112 | + * | |
113 | + * @return 月份 | |
114 | + */ | |
115 | + public static int getMonth() { | |
116 | + LocalDateTime localDateTime = LocalDateTime.now(); | |
117 | + return localDateTime.get(ChronoField.MONTH_OF_YEAR); | |
118 | + } | |
119 | + | |
120 | + /** | |
121 | + * 获取某月的第几天 | |
122 | + * | |
123 | + * @return 几号 | |
124 | + */ | |
125 | + public static int getMonthOfDay() { | |
126 | + LocalDateTime localDateTime = LocalDateTime.now(); | |
127 | + return localDateTime.get(ChronoField.DAY_OF_MONTH); | |
128 | + } | |
129 | + | |
130 | + /** | |
131 | + * 格式化日期为字符串 | |
132 | + * | |
133 | + * @param date date | |
134 | + * @param pattern 格式 | |
135 | + * @return 日期字符串 | |
136 | + */ | |
137 | + public static String formatOrElseBlank(Date date, String pattern) { | |
138 | + if (date == null || pattern == null) { | |
139 | + return ""; | |
140 | + } | |
141 | + Instant instant = date.toInstant(); | |
142 | + | |
143 | + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); | |
144 | + | |
145 | + return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 格式化日期为字符串 | |
150 | + * | |
151 | + * @param date date | |
152 | + * @param pattern 格式 | |
153 | + * @return 日期字符串 | |
154 | + */ | |
155 | + public static String format(Date date, String pattern) { | |
156 | + | |
157 | + Instant instant = date.toInstant(); | |
158 | + | |
159 | + LocalDateTime localDateTime = LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); | |
160 | + | |
161 | + return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); | |
162 | + } | |
163 | + | |
164 | + public static String formatNow(String pattern) { | |
165 | + LocalDateTime localDateTime = LocalDateTime.now(); | |
166 | + | |
167 | + return localDateTime.format(DateTimeFormatter.ofPattern(pattern)); | |
168 | + } | |
169 | + | |
170 | + | |
171 | + public static String format(LocalDateTime date, String pattern) { | |
172 | + return date.format(DateTimeFormatter.ofPattern(pattern)); | |
173 | + } | |
174 | + | |
175 | + public static String format(LocalDate date, String pattern) { | |
176 | + return date.format(DateTimeFormatter.ofPattern(pattern)); | |
177 | + } | |
178 | + | |
179 | + /** | |
180 | + * 解析字符串日期为LocalDateTime | |
181 | + * | |
182 | + * @param dateStr 日期字符串 | |
183 | + * @param pattern 格式 | |
184 | + * @return Date | |
185 | + */ | |
186 | + public static LocalDateTime parse(String dateStr, String pattern) { | |
187 | + return LocalDateTime.parse(dateStr, DateTimeFormatter.ofPattern(pattern)); | |
188 | + } | |
189 | + | |
190 | + /** | |
191 | + * 解析字符串日期为LocalDateTime | |
192 | + * | |
193 | + * @param dateStr 日期字符串 | |
194 | + * @param pattern 格式 | |
195 | + * @return Date | |
196 | + */ | |
197 | + public static LocalDateTime parseStrByPattern(String dateStr, String pattern) { | |
198 | + try { | |
199 | + return parse(dateStr, pattern); | |
200 | + } catch (Exception e) { | |
201 | + return getCurrentTime(); | |
202 | + } | |
203 | + } | |
204 | + | |
205 | + /** | |
206 | + * 解析字符串日期为LocalDate | |
207 | + * | |
208 | + * @param dateStr | |
209 | + * @param pattern | |
210 | + * @return | |
211 | + */ | |
212 | + public static LocalDate parseDate(String dateStr, String pattern) { | |
213 | + return LocalDate.parse(dateStr, DateTimeFormatter.ofPattern(pattern)); | |
214 | + } | |
215 | + | |
216 | + /** | |
217 | + * @param dateTimeStr | |
218 | + * @param prePattern | |
219 | + * @param expectPattern | |
220 | + * @return | |
221 | + */ | |
222 | + public static String format(String dateTimeStr, String prePattern, String expectPattern) { | |
223 | + LocalDateTime localDateTime = parseDate(dateTimeStr, prePattern).atStartOfDay(); | |
224 | + return localDateTime.format(DateTimeFormatter.ofPattern(expectPattern)); | |
225 | + } | |
226 | + | |
227 | + /** | |
228 | + * String -> Date | |
229 | + * | |
230 | + * @param date | |
231 | + * @return | |
232 | + */ | |
233 | + public static Date parseStringToDate(String date, String pattern) { | |
234 | + SimpleDateFormat sdf = new SimpleDateFormat(pattern); | |
235 | + try { | |
236 | + return sdf.parse(date); | |
237 | + } catch (ParseException e) { | |
238 | + return null; | |
239 | + } | |
240 | + } | |
241 | + | |
242 | + /** | |
243 | + * 为Date增加分钟,减传负数 | |
244 | + * | |
245 | + * @param date 日期 | |
246 | + * @param plusMinutes 要增加的分钟数 | |
247 | + * @return 新的日期 | |
248 | + */ | |
249 | + public static Date addMinutes(Date date, Long plusMinutes) { | |
250 | + LocalDateTime dateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); | |
251 | + LocalDateTime newDateTime = dateTime.plusMinutes(plusMinutes); | |
252 | + return Date.from(newDateTime.atZone(ZoneId.systemDefault()).toInstant()); | |
253 | + } | |
254 | + | |
255 | + /** | |
256 | + * 增加时间 | |
257 | + * | |
258 | + * @param date date | |
259 | + * @param hour 要增加的小时数 | |
260 | + * @return new date | |
261 | + */ | |
262 | + public static Date addHour(Date date, Long hour) { | |
263 | + LocalDateTime dateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault()); | |
264 | + LocalDateTime localDateTime = dateTime.plusHours(hour); | |
265 | + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); | |
266 | + } | |
267 | + | |
268 | + /** | |
269 | + * @return 返回当天的起始时间 | |
270 | + */ | |
271 | + public static Date getStartTime() { | |
272 | + | |
273 | + LocalDateTime now = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0); | |
274 | + return localDateTime2Date(now); | |
275 | + } | |
276 | + | |
277 | + | |
278 | + /** | |
279 | + * @return 返回当天的结束时间 | |
280 | + */ | |
281 | + public static Date getEndTime() { | |
282 | + LocalDateTime now = LocalDateTime.now().withHour(23).withMinute(59).withSecond(59).withNano(999999999); | |
283 | + return localDateTime2Date(now); | |
284 | + } | |
285 | + | |
286 | + /** | |
287 | + * @return 获取入参当天结束时间 | |
288 | + */ | |
289 | + public static LocalDateTime getEndTime(LocalDate localDate) { | |
290 | + return localDate.atTime(23, 59, 59, 999999999); | |
291 | + } | |
292 | + | |
293 | + /** | |
294 | + * 减月份 | |
295 | + * | |
296 | + * @param monthsToSubtract 月份 | |
297 | + * @return Date | |
298 | + */ | |
299 | + public static Date minusMonths(long monthsToSubtract) { | |
300 | + LocalDate localDate = LocalDate.now().minusMonths(monthsToSubtract); | |
301 | + | |
302 | + return localDate2Date(localDate); | |
303 | + } | |
304 | + | |
305 | + /** | |
306 | + * LocalDate类型转为Date | |
307 | + * | |
308 | + * @param localDate LocalDate object | |
309 | + * @return Date object | |
310 | + */ | |
311 | + public static Date localDate2Date(LocalDate localDate) { | |
312 | + | |
313 | + ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault()); | |
314 | + | |
315 | + return Date.from(zonedDateTime.toInstant()); | |
316 | + } | |
317 | + | |
318 | + /** | |
319 | + * Date类型转为LocalDateTime | |
320 | + * | |
321 | + * @param date Date object | |
322 | + * @return localDate LocalDateTime | |
323 | + */ | |
324 | + public static LocalDateTime date2LocalDateTime(Date date) { | |
325 | + | |
326 | + Instant instant = date.toInstant(); | |
327 | + ZoneId zoneId = ZoneId.systemDefault(); | |
328 | + LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); | |
329 | + return localDateTime; | |
330 | + } | |
331 | + | |
332 | + | |
333 | + /** | |
334 | + * LocalDateTime类型转为Date | |
335 | + * | |
336 | + * @param localDateTime LocalDateTime object | |
337 | + * @return Date object | |
338 | + */ | |
339 | + public static Date localDateTime2Date(LocalDateTime localDateTime) { | |
340 | + return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); | |
341 | + } | |
342 | + | |
343 | + /** | |
344 | + * 查询当前年的第一天 | |
345 | + * | |
346 | + * @param pattern 格式,默认格式yyyyMMdd | |
347 | + * @return 20190101 | |
348 | + */ | |
349 | + public static String getFirstDayOfCurrentYear(String pattern) { | |
350 | + LocalDateTime localDateTime = LocalDateTime.now().withMonth(1).withDayOfMonth(1); | |
351 | + | |
352 | + if (StringUtils.isEmpty(pattern)) { | |
353 | + pattern = "yyyyMMdd"; | |
354 | + } | |
355 | + | |
356 | + return format(localDateTime2Date(localDateTime), pattern); | |
357 | + } | |
358 | + | |
359 | + /** | |
360 | + * 查询前一年最后一个月第一天 | |
361 | + * | |
362 | + * @param pattern 格式,默认格式yyyyMMdd | |
363 | + * @return 20190101 | |
364 | + */ | |
365 | + public static String getLastMonthFirstDayOfPreviousYear(String pattern) { | |
366 | + LocalDateTime localDateTime = LocalDateTime.now().minusYears(1L).withMonth(12).withDayOfMonth(1); | |
367 | + | |
368 | + if (StringUtils.isEmpty(pattern)) { | |
369 | + pattern = "yyyyMMdd"; | |
370 | + } | |
371 | + | |
372 | + return format(localDateTime2Date(localDateTime), pattern); | |
373 | + } | |
374 | + | |
375 | + /** | |
376 | + * 查询前一年最后一个月第一天 | |
377 | + * | |
378 | + * @param pattern 格式,默认格式yyyyMMdd | |
379 | + * @return 20190101 | |
380 | + */ | |
381 | + public static String getLastMonthLastDayOfPreviousYear(String pattern) { | |
382 | + LocalDateTime localDateTime = LocalDateTime.now().minusYears(1L).with(TemporalAdjusters.lastDayOfYear()); | |
383 | + | |
384 | + if (StringUtils.isEmpty(pattern)) { | |
385 | + pattern = "yyyyMMdd"; | |
386 | + } | |
387 | + | |
388 | + return format(localDateTime2Date(localDateTime), pattern); | |
389 | + } | |
390 | + | |
391 | + /** | |
392 | + * 获取当前日期 | |
393 | + * | |
394 | + * @param pattern 格式,默认格式yyyyMMdd | |
395 | + * @return 20190101 | |
396 | + */ | |
397 | + public static String getCurrentDay(String pattern) { | |
398 | + LocalDateTime localDateTime = LocalDateTime.now(); | |
399 | + | |
400 | + if (StringUtils.isEmpty(pattern)) { | |
401 | + pattern = "yyyyMMdd"; | |
402 | + } | |
403 | + | |
404 | + return format(localDateTime2Date(localDateTime), pattern); | |
405 | + } | |
406 | + | |
407 | + public static String getTransitionTime(LocalDateTime time, String pattern) { | |
408 | + if (StringUtils.isEmpty(pattern)) { | |
409 | + pattern = "yyyyMMdd"; | |
410 | + } | |
411 | + return format(localDateTime2Date(time), pattern); | |
412 | + } | |
413 | + | |
414 | + | |
415 | + /** | |
416 | + * 用于判断两个时间段有没有重合, 重合: true,未重合: false | |
417 | + * | |
418 | + * @param aStartTime | |
419 | + * @param aEndTime | |
420 | + * @param bStartTime | |
421 | + * @param bEndTime | |
422 | + * @return | |
423 | + * @author A80068 | |
424 | + */ | |
425 | + public static boolean judgeTimeSlotCoincidence(LocalDateTime aStartTime, LocalDateTime aEndTime, LocalDateTime bStartTime, LocalDateTime bEndTime) { | |
426 | + /** | |
427 | + * 旧版 | |
428 | + */ | |
429 | + //boolean flag; | |
430 | + //if(aStartTime.isAfter(bStartTime)){ | |
431 | + // if (aStartTime.isBefore(bEndTime) || aStartTime.isEqual(bEndTime)){ | |
432 | + // flag = true; | |
433 | + // }else{ | |
434 | + // flag = false; | |
435 | + // } | |
436 | + //}else if(aStartTime.isBefore(bStartTime)){ | |
437 | + // if(aEndTime.isAfter(bStartTime) || aEndTime.isEqual(bStartTime)){ | |
438 | + // flag = true; | |
439 | + // }else{ | |
440 | + // flag = false; | |
441 | + // } | |
442 | + //}else{ | |
443 | + // flag = true; | |
444 | + //} | |
445 | + //return flag; | |
446 | + /** | |
447 | + * 优化版 | |
448 | + */ | |
449 | + boolean flag = false; | |
450 | + if ((aStartTime.isBefore(bEndTime) || aStartTime.isEqual(bEndTime))) { | |
451 | + if ((aEndTime.isAfter(bStartTime)) || aEndTime.isEqual(bStartTime)) { | |
452 | + flag = true; | |
453 | + } | |
454 | + } | |
455 | + return flag; | |
456 | + } | |
457 | + | |
458 | + /** | |
459 | + * @param aStartTimeStr | |
460 | + * @param aEndTimeStr | |
461 | + * @param bStartTimeStr | |
462 | + * @param bEndTimeStr | |
463 | + * @return | |
464 | + * @author A80068 | |
465 | + */ | |
466 | + public static boolean judgeTimeSlotCoincidenceString(String aStartTimeStr, String aEndTimeStr, String bStartTimeStr, String bEndTimeStr) { | |
467 | + | |
468 | + LocalDateTime aStartTime = parse(aStartTimeStr, DATE_TIME); | |
469 | + LocalDateTime aEndTime = parse(aEndTimeStr, DATE_TIME); | |
470 | + LocalDateTime bStartTime = parse(bStartTimeStr, DATE_TIME); | |
471 | + LocalDateTime bEndTime = parse(bEndTimeStr, DATE_TIME); | |
472 | + | |
473 | + return judgeTimeSlotCoincidence(aStartTime, aEndTime, bStartTime, bEndTime); | |
474 | + } | |
475 | + | |
476 | + /** | |
477 | + * @param strGMT | |
478 | + * @return | |
479 | + * @throws ParseException | |
480 | + * @throws ParseException | |
481 | + */ | |
482 | + public static Date getCST(String strGMT) throws ParseException, ParseException { | |
483 | + DateFormat df = new SimpleDateFormat("EEE, d-MMM-yyyy HH:mm:ss z", Locale.ENGLISH); | |
484 | + return df.parse(strGMT); | |
485 | + } | |
486 | + | |
487 | + /** | |
488 | + * @param dateCST | |
489 | + * @return | |
490 | + */ | |
491 | + public static Date getGMT(Date dateCST) throws ParseException { | |
492 | + DateFormat df = new SimpleDateFormat("EEE, d-MMM-yyyy HH:mm:ss z", Locale.ENGLISH); | |
493 | + df.setTimeZone(TimeZone.getTimeZone("GMT")); // modify Time Zone. | |
494 | + return df.parse(df.format(dateCST)); | |
495 | + } | |
496 | + | |
497 | + /** | |
498 | + * LocalDateTime转化为cron表达式 | |
499 | + * | |
500 | + * @param dateTime | |
501 | + * @return | |
502 | + */ | |
503 | + public static String dateToCron(LocalDateTime dateTime) { | |
504 | + if (dateTime == null) { | |
505 | + return ""; | |
506 | + } | |
507 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ss mm HH dd MM ? yyyy"); | |
508 | + return formatter.format(dateTime); | |
509 | + } | |
510 | + | |
511 | + /** | |
512 | + * cron表达式转为LocalDateTime | |
513 | + * | |
514 | + * @param cron | |
515 | + * @return | |
516 | + */ | |
517 | + public static LocalDateTime cronToDate(String cron) { | |
518 | + if (StringUtils.isNotBlank(cron)) { | |
519 | + return null; | |
520 | + } | |
521 | + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("ss mm HH dd MM ? yyyy"); | |
522 | + return LocalDateTime.parse(cron, formatter); | |
523 | + } | |
524 | + | |
525 | + public static String timeToString(long time) { | |
526 | + DateTimeFormatter ftf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | |
527 | + return ftf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault())); | |
528 | + } | |
529 | + | |
530 | + public static String timeToString(String time) { | |
531 | + try { | |
532 | + return timeToString(Long.parseLong(time)); | |
533 | + } catch (Exception e) { | |
534 | + } | |
535 | + return time; | |
536 | + } | |
537 | + | |
538 | + /** | |
539 | + * 比较时间大小 | |
540 | + * | |
541 | + * @param date1 | |
542 | + * @param date2 | |
543 | + * @return | |
544 | + */ | |
545 | + public static int compareDate(Date date1, Date date2) { | |
546 | + if (date1 == null || date2 == null) { | |
547 | + return -2; | |
548 | + } | |
549 | + if (date1.getTime() < date2.getTime()) { | |
550 | + return -1; | |
551 | + } else if (date1.getTime() > date2.getTime()) { | |
552 | + return 1; | |
553 | + } | |
554 | + return 0; | |
555 | + } | |
556 | + | |
557 | + /** | |
558 | + * 判斷两个时间是否在同一分钟 | |
559 | + */ | |
560 | + public static boolean isMinuteIdentical(LocalDateTime date1, LocalDateTime date2) { | |
561 | + return date1.getYear() == date2.getYear() && date1.getMonth() == date2.getMonth() && date1.getMinute() == date2.getMinute(); | |
562 | + } | |
563 | + | |
564 | + /** | |
565 | + * 时区 | |
566 | + */ | |
567 | + public static class Zone { | |
568 | + public static final String GMT8 = "GMT+8"; | |
569 | + } | |
570 | +} | ... | ... |
src/main/java/com/order/erp/common/utils/ImgCaptchaUtils.java
0 → 100644
1 | +package com.order.erp.common.utils; | |
2 | + | |
3 | +import cn.hutool.core.util.IdUtil; | |
4 | +import com.order.erp.common.exception.BusinessException; | |
5 | +import com.order.erp.security.config.SecurityProperties; | |
6 | +import lombok.extern.slf4j.Slf4j; | |
7 | +import org.springframework.beans.factory.annotation.Value; | |
8 | +import org.springframework.stereotype.Service; | |
9 | + | |
10 | +import javax.annotation.Resource; | |
11 | +import java.util.concurrent.TimeUnit; | |
12 | + | |
13 | + | |
14 | +@Slf4j | |
15 | +@Service | |
16 | +public class ImgCaptchaUtils { | |
17 | + | |
18 | + @Resource | |
19 | + private SecurityProperties properties; | |
20 | + | |
21 | + @Resource | |
22 | + private RedisUtil redisUtil; | |
23 | + | |
24 | + @Value("${loginCode.expiration}") | |
25 | + private Long expiration; | |
26 | + | |
27 | + /** | |
28 | + * @param imgCaptchaCode | |
29 | + * @param imgCaptchaUuid | |
30 | + */ | |
31 | + public void validateImgCaptcha(String imgCaptchaCode, String imgCaptchaUuid) { | |
32 | + // 查询验证码 | |
33 | + String code = redisUtil.get(imgCaptchaUuid); | |
34 | + // 清除验证码 | |
35 | + redisUtil.delete(imgCaptchaUuid); | |
36 | + if (StringUtils.isBlank(code)) { | |
37 | + throw new BusinessException(com.canrd.shop.common.constant.ServerResultCode.IMG_CAPTCHA_EXPIRE_ERROR); | |
38 | + } | |
39 | + if (StringUtils.isBlank(imgCaptchaCode) || !imgCaptchaCode.equalsIgnoreCase(code)) { | |
40 | + throw new BusinessException(com.canrd.shop.common.constant.ServerResultCode.IMG_CAPTCHA_ERROR); | |
41 | + } | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * @param imgCaptchaCode | |
46 | + * @return | |
47 | + */ | |
48 | + public String setImgCaptcha4uuid(String imgCaptchaCode) { | |
49 | + String uuid = properties.getCodeKey() + IdUtil.simpleUUID(); | |
50 | + // 保存 | |
51 | + redisUtil.set(uuid, imgCaptchaCode, expiration, TimeUnit.MINUTES); | |
52 | + return uuid; | |
53 | + } | |
54 | + | |
55 | +} | ... | ... |
src/main/java/com/order/erp/common/utils/PageUtils.java
... | ... | @@ -2,7 +2,7 @@ package com.order.erp.common.utils; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.metadata.IPage; |
4 | 4 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
5 | -import com.canrd.shop.domain.vo.BasePageVO; | |
5 | +import com.order.erp.domain.vo.BasePageVO; | |
6 | 6 | import org.springframework.util.CollectionUtils; |
7 | 7 | |
8 | 8 | import java.io.Serializable; | ... | ... |
src/main/java/com/order/erp/common/utils/RedisUtil.java
0 → 100644
1 | +package com.order.erp.common.utils; | |
2 | + | |
3 | +import lombok.extern.slf4j.Slf4j; | |
4 | +import org.springframework.data.redis.connection.DataType; | |
5 | +import org.springframework.data.redis.core.*; | |
6 | +import org.springframework.stereotype.Repository; | |
7 | + | |
8 | +import javax.annotation.Resource; | |
9 | +import java.util.*; | |
10 | +import java.util.concurrent.TimeUnit; | |
11 | +import java.util.stream.Collectors; | |
12 | + | |
13 | +/** | |
14 | + * @Date: 2020/9/1 | |
15 | + */ | |
16 | +@Slf4j | |
17 | +@Repository("redisUtil") | |
18 | +public class RedisUtil { | |
19 | + | |
20 | + @Resource(name = "stringRedisTemplate") | |
21 | + private StringRedisTemplate redisTemplate; | |
22 | + | |
23 | + | |
24 | + /* -------------------key相关操作--------------------- */ | |
25 | + | |
26 | + /** | |
27 | + * 删除key | |
28 | + * | |
29 | + * @param key key key | |
30 | + */ | |
31 | + public void delete(String key) { | |
32 | + redisTemplate.delete(key); | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * 批量删除key | |
37 | + * | |
38 | + * @param keys keys | |
39 | + */ | |
40 | + public void delete(Collection<String> keys) { | |
41 | + redisTemplate.delete(keys); | |
42 | + } | |
43 | + | |
44 | + /** | |
45 | + * 序列化key | |
46 | + * | |
47 | + * @param key key | |
48 | + * @return | |
49 | + */ | |
50 | + public byte[] dump(String key) { | |
51 | + return redisTemplate.dump(key); | |
52 | + } | |
53 | + | |
54 | + /** | |
55 | + * 是否存在key | |
56 | + * | |
57 | + * @param key key | |
58 | + * @return | |
59 | + */ | |
60 | + public Boolean hasKey(String key) { | |
61 | + return redisTemplate.hasKey(key); | |
62 | + } | |
63 | + | |
64 | + /** | |
65 | + * 设置过期时间 | |
66 | + * | |
67 | + * @param key key | |
68 | + * @param timeout | |
69 | + * @param unit | |
70 | + * @return | |
71 | + */ | |
72 | + public Boolean expire(String key, long timeout, TimeUnit unit) { | |
73 | + return redisTemplate.expire(key, timeout, unit); | |
74 | + } | |
75 | + | |
76 | + /** | |
77 | + * 设置过期时间 | |
78 | + * | |
79 | + * @param key key | |
80 | + * @param date | |
81 | + * @return | |
82 | + */ | |
83 | + public Boolean expireAt(String key, Date date) { | |
84 | + return redisTemplate.expireAt(key, date); | |
85 | + } | |
86 | + | |
87 | + /** | |
88 | + * 查找匹配的key | |
89 | + * | |
90 | + * @param pattern | |
91 | + * @return | |
92 | + */ | |
93 | + public Set<String> keys(String pattern) { | |
94 | + return redisTemplate.keys(pattern); | |
95 | + } | |
96 | + | |
97 | + /** | |
98 | + * 将当前数据库的 key 移动到给定的数据库 db 当中 | |
99 | + * | |
100 | + * @param key key | |
101 | + * @param dbIndex | |
102 | + * @return | |
103 | + */ | |
104 | + public Boolean move(String key, int dbIndex) { | |
105 | + return redisTemplate.move(key, dbIndex); | |
106 | + } | |
107 | + | |
108 | + /** | |
109 | + * 移除 key 的过期时间,key 将持久保持 | |
110 | + * | |
111 | + * @param key key | |
112 | + * @return | |
113 | + */ | |
114 | + public Boolean persist(String key) { | |
115 | + return redisTemplate.persist(key); | |
116 | + } | |
117 | + | |
118 | + /** | |
119 | + * 返回 key 的剩余的过期时间 | |
120 | + * | |
121 | + * @param key key | |
122 | + * @param unit | |
123 | + * @return | |
124 | + */ | |
125 | + public Long getExpire(String key, TimeUnit unit) { | |
126 | + return redisTemplate.getExpire(key, unit); | |
127 | + } | |
128 | + | |
129 | + /** | |
130 | + * 返回 key 的剩余的过期时间 | |
131 | + * | |
132 | + * @param key key | |
133 | + * @return | |
134 | + */ | |
135 | + public Long getExpire(String key) { | |
136 | + return redisTemplate.getExpire(key); | |
137 | + } | |
138 | + | |
139 | + /** | |
140 | + * 从当前数据库中随机返回一个 key | |
141 | + * | |
142 | + * @return | |
143 | + */ | |
144 | + public String randomKey() { | |
145 | + return redisTemplate.randomKey(); | |
146 | + } | |
147 | + | |
148 | + /** | |
149 | + * 修改 key 的名称 | |
150 | + * | |
151 | + * @param oldKey | |
152 | + * @param newKey | |
153 | + */ | |
154 | + public void rename(String oldKey, String newKey) { | |
155 | + redisTemplate.rename(oldKey, newKey); | |
156 | + } | |
157 | + | |
158 | + /** | |
159 | + * 仅当 newkey 不存在时,将 oldKey 改名为 newkey | |
160 | + * | |
161 | + * @param oldKey | |
162 | + * @param newKey | |
163 | + * @return | |
164 | + */ | |
165 | + public Boolean renameIfAbsent(String oldKey, String newKey) { | |
166 | + return redisTemplate.renameIfAbsent(oldKey, newKey); | |
167 | + } | |
168 | + | |
169 | + /** | |
170 | + * 返回 key 所储存的值的类型 | |
171 | + * | |
172 | + * @param key key | |
173 | + * @return | |
174 | + */ | |
175 | + public DataType type(String key) { | |
176 | + return redisTemplate.type(key); | |
177 | + } | |
178 | + | |
179 | + /** | |
180 | + * -------------------string相关操作--------------------- | |
181 | + *//* | |
182 | + | |
183 | + /** | |
184 | + * 设置指定 key 的值 | |
185 | + * @param key key | |
186 | + * @param value val | |
187 | + */ | |
188 | + public void set(String key, String value) { | |
189 | + redisTemplate.opsForValue().set(key, value); | |
190 | + } | |
191 | + | |
192 | + /** | |
193 | + * 设置缓存,指定有效时间 | |
194 | + * 时间单位为 秒 | |
195 | + * | |
196 | + * @param key | |
197 | + * @param value | |
198 | + * @param expireTime | |
199 | + */ | |
200 | + public void set(String key, String value, Long expireTime) { | |
201 | + redisTemplate.opsForValue().set(key, value, expireTime, TimeUnit.SECONDS); | |
202 | + } | |
203 | + | |
204 | + /** | |
205 | + * 设置缓存,指定有效时间 | |
206 | + * 时间单位 自定义 | |
207 | + * | |
208 | + * @param key | |
209 | + * @param value | |
210 | + * @param expireTime | |
211 | + * @param timeUnit | |
212 | + */ | |
213 | + public void set(String key, String value, Long expireTime, TimeUnit timeUnit) { | |
214 | + redisTemplate.opsForValue().set(key, value, expireTime, timeUnit); | |
215 | + } | |
216 | + | |
217 | + /** | |
218 | + * 获取指定 key 的值 | |
219 | + * | |
220 | + * @param key key | |
221 | + * @return | |
222 | + */ | |
223 | + public String get(String key) { | |
224 | + return redisTemplate.opsForValue().get(key); | |
225 | + } | |
226 | + | |
227 | + /** | |
228 | + * 返回 key 中字符串值的子字符 | |
229 | + * | |
230 | + * @param key key | |
231 | + * @param start | |
232 | + * @param end | |
233 | + * @return | |
234 | + */ | |
235 | + public String getRange(String key, long start, long end) { | |
236 | + return redisTemplate.opsForValue().get(key, start, end); | |
237 | + } | |
238 | + | |
239 | + /** | |
240 | + * 将给定 key 的值设为 value ,并返回 key 的旧值(old value) | |
241 | + * | |
242 | + * @param key key | |
243 | + * @param value val | |
244 | + * @return | |
245 | + */ | |
246 | + public String getAndSet(String key, String value) { | |
247 | + return redisTemplate.opsForValue().getAndSet(key, value); | |
248 | + } | |
249 | + | |
250 | + /** | |
251 | + * 对 key 所储存的字符串值,获取指定偏移量上的位(bit) | |
252 | + * | |
253 | + * @param key key | |
254 | + * @param offset | |
255 | + * @return | |
256 | + */ | |
257 | + public Boolean getBit(String key, long offset) { | |
258 | + return redisTemplate.opsForValue().getBit(key, offset); | |
259 | + } | |
260 | + | |
261 | + /** | |
262 | + * 批量获取 | |
263 | + * | |
264 | + * @param keys keys | |
265 | + * @return 多个key的value | |
266 | + */ | |
267 | + public List<String> multiGet(Collection<String> keys) { | |
268 | + return redisTemplate.opsForValue().multiGet(keys); | |
269 | + } | |
270 | + | |
271 | + public List<String> multiGetPip(Collection<String> keys) { | |
272 | + return redisTemplate.executePipelined((RedisCallback<String>) connection -> { | |
273 | + keys.forEach(a -> connection.get(a.getBytes())); | |
274 | + return null; | |
275 | + }).stream() | |
276 | + .filter(Objects::nonNull) | |
277 | + .map(Object::toString) | |
278 | + .collect(Collectors.toList()); | |
279 | + } | |
280 | + | |
281 | + /** | |
282 | + * 设置ASCII码, 字符串'a'的ASCII码是97, 转为二进制是'01100001', 此方法是将二进制第offset位值变为value | |
283 | + * | |
284 | + * @param key key | |
285 | + * @param offset 偏移 | |
286 | + * @param value val | |
287 | + */ | |
288 | + public Boolean setBit(String key, long offset, boolean value) { | |
289 | + return redisTemplate.opsForValue().setBit(key, offset, value); | |
290 | + } | |
291 | + | |
292 | + /** | |
293 | + * 将值 value 关联到 key ,并将 key 的过期时间设为 timeout | |
294 | + * | |
295 | + * @param key key | |
296 | + * @param value val | |
297 | + * @param timeout 过期时间 | |
298 | + * @param unit 时间单位, 天:TimeUnit.DAYS 小时:TimeUnit.HOURS 分钟:TimeUnit.MINUTES | |
299 | + * 秒:TimeUnit.SECONDS 毫秒:TimeUnit.MILLISECONDS | |
300 | + */ | |
301 | + public void setEx(String key, String value, long timeout, TimeUnit unit) { | |
302 | + redisTemplate.opsForValue().set(key, value, timeout, unit); | |
303 | + } | |
304 | + | |
305 | + /** | |
306 | + * 只有在 key 不存在时设置 key 的值 | |
307 | + * | |
308 | + * @param key key | |
309 | + * @param value val | |
310 | + * @return 之前已经存在返回false, 不存在返回true | |
311 | + */ | |
312 | + public Boolean setIfAbsent(String key, String value) { | |
313 | + return redisTemplate.opsForValue().setIfAbsent(key, value); | |
314 | + } | |
315 | + | |
316 | + | |
317 | + /** | |
318 | + * 用 value 参数覆写给定 key 所储存的字符串值,从偏移量 offset 开始 | |
319 | + * | |
320 | + * @param key key | |
321 | + * @param value val | |
322 | + * @param offset 从指定位置开始覆写 | |
323 | + */ | |
324 | + public void setRange(String key, String value, long offset) { | |
325 | + redisTemplate.opsForValue().set(key, value, offset); | |
326 | + } | |
327 | + | |
328 | + /** | |
329 | + * 获取字符串的长度 | |
330 | + * | |
331 | + * @param key key | |
332 | + */ | |
333 | + public Long size(String key) { | |
334 | + return redisTemplate.opsForValue().size(key); | |
335 | + } | |
336 | + | |
337 | + /** | |
338 | + * 批量添加 | |
339 | + */ | |
340 | + public void multiSet(Map<String, String> maps) { | |
341 | + redisTemplate.opsForValue().multiSet(maps); | |
342 | + } | |
343 | + | |
344 | + /** | |
345 | + * 同时设置一个或多个 key-value 对,当且仅当所有给定 key 都不存在 | |
346 | + * | |
347 | + * @return 之前已经存在返回false, 不存在返回true | |
348 | + */ | |
349 | + public Boolean multiSetIfAbsent(Map<String, String> maps) { | |
350 | + return redisTemplate.opsForValue().multiSetIfAbsent(maps); | |
351 | + } | |
352 | + | |
353 | + /** | |
354 | + * 增加(自增长), 负数则为自减 | |
355 | + * | |
356 | + * @param key key | |
357 | + * @param increment 步长 | |
358 | + */ | |
359 | + public Long incrBy(String key, long increment) { | |
360 | + return redisTemplate.opsForValue().increment(key, increment); | |
361 | + } | |
362 | + | |
363 | + /** | |
364 | + * @param key key | |
365 | + * @param increment 步长 | |
366 | + */ | |
367 | + public Double incrByFloat(String key, double increment) { | |
368 | + return redisTemplate.opsForValue().increment(key, increment); | |
369 | + } | |
370 | + | |
371 | + /** | |
372 | + * 增加(自增长), 负数则为自减 | |
373 | + * | |
374 | + * @param key key redisKey | |
375 | + * @param decrement 步长 | |
376 | + */ | |
377 | + public Long decreByLong(String key, long decrement) { | |
378 | + return redisTemplate.opsForValue().decrement(key, decrement); | |
379 | + } | |
380 | + | |
381 | + /** | |
382 | + * @param key key redisKey | |
383 | + */ | |
384 | + public Long decreBy(String key) { | |
385 | + return redisTemplate.opsForValue().decrement(key); | |
386 | + } | |
387 | + | |
388 | + /** | |
389 | + * 追加到末尾 | |
390 | + * | |
391 | + * @param key key | |
392 | + * @param value val | |
393 | + * @return | |
394 | + */ | |
395 | + public Integer append(String key, String value) { | |
396 | + return redisTemplate.opsForValue().append(key, value); | |
397 | + } | |
398 | + | |
399 | + /** -------------------hash相关操作------------------------- */ | |
400 | + | |
401 | + /** | |
402 | + * 获取存储在哈希表中指定字段的值 | |
403 | + * | |
404 | + * @param key key | |
405 | + * @param field | |
406 | + * @return | |
407 | + */ | |
408 | + public Object hGet(String key, String field) { | |
409 | + return redisTemplate.opsForHash().get(key, field); | |
410 | + } | |
411 | + | |
412 | + /** | |
413 | + * 获取所有给定字段的值 | |
414 | + * | |
415 | + * @param key key | |
416 | + * @return | |
417 | + */ | |
418 | + public Map<Object, Object> hGetAll(String key) { | |
419 | + return redisTemplate.opsForHash().entries(key); | |
420 | + } | |
421 | + | |
422 | + /** | |
423 | + * 获取所有给定字段的值 | |
424 | + * | |
425 | + * @param key key | |
426 | + * @param fields | |
427 | + * @return | |
428 | + */ | |
429 | + public List<Object> hMultiGet(String key, Collection<Object> fields) { | |
430 | + return redisTemplate.opsForHash().multiGet(key, fields); | |
431 | + } | |
432 | + | |
433 | + public void hPut(String key, String hashKey, String value) { | |
434 | + redisTemplate.opsForHash().put(key, hashKey, value); | |
435 | + } | |
436 | + | |
437 | + public void hPutAll(String key, Map<String, String> maps) { | |
438 | + redisTemplate.opsForHash().putAll(key, maps); | |
439 | + } | |
440 | + | |
441 | + /** | |
442 | + * 仅当hashKey不存在时才设置 | |
443 | + * | |
444 | + * @param key key | |
445 | + * @param hashKey | |
446 | + * @param value val | |
447 | + * @return | |
448 | + */ | |
449 | + public Boolean hPutIfAbsent(String key, String hashKey, String value) { | |
450 | + return redisTemplate.opsForHash().putIfAbsent(key, hashKey, value); | |
451 | + } | |
452 | + | |
453 | + /** | |
454 | + * 删除一个或多个哈希表字段 | |
455 | + * | |
456 | + * @param key key | |
457 | + * @param fields | |
458 | + * @return | |
459 | + */ | |
460 | + public Long hDelete(String key, Object... fields) { | |
461 | + return redisTemplate.opsForHash().delete(key, fields); | |
462 | + } | |
463 | + | |
464 | + /** | |
465 | + * 查看哈希表 key 中,指定的字段是否存在 | |
466 | + * | |
467 | + * @param key key | |
468 | + * @param field | |
469 | + * @return | |
470 | + */ | |
471 | + public Boolean hExists(String key, String field) { | |
472 | + return redisTemplate.opsForHash().hasKey(key, field); | |
473 | + } | |
474 | + | |
475 | + /** | |
476 | + * 为哈希表 key 中的指定字段的整数值加上增量 increment | |
477 | + * | |
478 | + * @param key key | |
479 | + * @param field | |
480 | + * @param increment | |
481 | + * @return | |
482 | + */ | |
483 | + public Long hIncrBy(String key, Object field, long increment) { | |
484 | + return redisTemplate.opsForHash().increment(key, field, increment); | |
485 | + } | |
486 | + | |
487 | + /** | |
488 | + * 为哈希表 key 中的指定字段的整数值加上增量 increment | |
489 | + * | |
490 | + * @param key key | |
491 | + * @param field | |
492 | + * @param delta | |
493 | + * @return | |
494 | + */ | |
495 | + public Double hIncrByFloat(String key, Object field, double delta) { | |
496 | + return redisTemplate.opsForHash().increment(key, field, delta); | |
497 | + } | |
498 | + | |
499 | + /** | |
500 | + * 获取所有哈希表中的字段 | |
501 | + * | |
502 | + * @param key key | |
503 | + * @return | |
504 | + */ | |
505 | + public Set<Object> hKeys(String key) { | |
506 | + return redisTemplate.opsForHash().keys(key); | |
507 | + } | |
508 | + | |
509 | + /** | |
510 | + * 获取哈希表中字段的数量 | |
511 | + * | |
512 | + * @param key key | |
513 | + * @return | |
514 | + */ | |
515 | + public Long hSize(String key) { | |
516 | + return redisTemplate.opsForHash().size(key); | |
517 | + } | |
518 | + | |
519 | + /** | |
520 | + * 获取哈希表中所有值 | |
521 | + * | |
522 | + * @param key key | |
523 | + * @return | |
524 | + */ | |
525 | + public List<Object> hValues(String key) { | |
526 | + return redisTemplate.opsForHash().values(key); | |
527 | + } | |
528 | + | |
529 | + /** | |
530 | + * 迭代哈希表中的键值对 | |
531 | + * | |
532 | + * @param key key | |
533 | + * @param options | |
534 | + * @return | |
535 | + */ | |
536 | + public Cursor<Map.Entry<Object, Object>> hScan(String key, ScanOptions options) { | |
537 | + return redisTemplate.opsForHash().scan(key, options); | |
538 | + } | |
539 | + | |
540 | + /** ------------------------list相关操作---------------------------- */ | |
541 | + | |
542 | + /** | |
543 | + * 通过索引获取列表中的元素 | |
544 | + * | |
545 | + * @param key key | |
546 | + * @param index | |
547 | + * @return | |
548 | + */ | |
549 | + public String lIndex(String key, long index) { | |
550 | + return redisTemplate.opsForList().index(key, index); | |
551 | + } | |
552 | + | |
553 | + /** | |
554 | + * 获取列表指定范围内的元素 | |
555 | + * | |
556 | + * @param key key | |
557 | + * @param start 开始位置, 0是开始位置 | |
558 | + * @param end 结束位置, -1返回所有 | |
559 | + * @return | |
560 | + */ | |
561 | + public List<String> lRange(String key, long start, long end) { | |
562 | + return redisTemplate.opsForList().range(key, start, end); | |
563 | + } | |
564 | + | |
565 | + /** | |
566 | + * 存储在list头部 | |
567 | + * | |
568 | + * @param key key | |
569 | + * @param value val | |
570 | + * @return | |
571 | + */ | |
572 | + public Long lLeftPush(String key, String value) { | |
573 | + return redisTemplate.opsForList().leftPush(key, value); | |
574 | + } | |
575 | + | |
576 | + /** | |
577 | + * @param key key | |
578 | + * @param value val | |
579 | + * @return | |
580 | + */ | |
581 | + public Long lLeftPushAll(String key, String... value) { | |
582 | + return redisTemplate.opsForList().leftPushAll(key, value); | |
583 | + } | |
584 | + | |
585 | + /** | |
586 | + * @param key key | |
587 | + * @param value val | |
588 | + * @return | |
589 | + */ | |
590 | + public Long lLeftPushAll(String key, Collection<String> value) { | |
591 | + return redisTemplate.opsForList().leftPushAll(key, value); | |
592 | + } | |
593 | + | |
594 | + /** | |
595 | + * 当list存在的时候才加入 | |
596 | + * | |
597 | + * @param key key | |
598 | + * @param value val | |
599 | + * @return | |
600 | + */ | |
601 | + public Long lLeftPushIfPresent(String key, String value) { | |
602 | + return redisTemplate.opsForList().leftPushIfPresent(key, value); | |
603 | + } | |
604 | + | |
605 | + /** | |
606 | + * 如果pivot存在,再pivot前面添加 | |
607 | + * | |
608 | + * @param key key | |
609 | + * @param pivot | |
610 | + * @param value val | |
611 | + * @return | |
612 | + */ | |
613 | + public Long lLeftPush(String key, String pivot, String value) { | |
614 | + return redisTemplate.opsForList().leftPush(key, pivot, value); | |
615 | + } | |
616 | + | |
617 | + /** | |
618 | + * @param key key | |
619 | + * @param value val | |
620 | + * @return | |
621 | + */ | |
622 | + public Long lRightPush(String key, String value) { | |
623 | + return redisTemplate.opsForList().rightPush(key, value); | |
624 | + } | |
625 | + | |
626 | + /** | |
627 | + * @param key key | |
628 | + * @param value val | |
629 | + * @return | |
630 | + */ | |
631 | + public Long lRightPushAll(String key, String... value) { | |
632 | + return redisTemplate.opsForList().rightPushAll(key, value); | |
633 | + } | |
634 | + | |
635 | + /** | |
636 | + * @param key key | |
637 | + * @param value val | |
638 | + * @return | |
639 | + */ | |
640 | + public Long lRightPushAll(String key, Collection<String> value) { | |
641 | + return redisTemplate.opsForList().rightPushAll(key, value); | |
642 | + } | |
643 | + | |
644 | + /** | |
645 | + * 为已存在的列表添加值 | |
646 | + * | |
647 | + * @param key key | |
648 | + * @param value val | |
649 | + * @return | |
650 | + */ | |
651 | + public Long lRightPushIfPresent(String key, String value) { | |
652 | + return redisTemplate.opsForList().rightPushIfPresent(key, value); | |
653 | + } | |
654 | + | |
655 | + /** | |
656 | + * 在pivot元素的右边添加值 | |
657 | + * | |
658 | + * @param key key | |
659 | + * @param pivot | |
660 | + * @param value val | |
661 | + * @return | |
662 | + */ | |
663 | + public Long lRightPush(String key, String pivot, String value) { | |
664 | + return redisTemplate.opsForList().rightPush(key, pivot, value); | |
665 | + } | |
666 | + | |
667 | + /** | |
668 | + * 通过索引设置列表元素的值 | |
669 | + * | |
670 | + * @param key key | |
671 | + * @param index 位置 | |
672 | + * @param value val | |
673 | + */ | |
674 | + public void lSet(String key, long index, String value) { | |
675 | + redisTemplate.opsForList().set(key, index, value); | |
676 | + } | |
677 | + | |
678 | + /** | |
679 | + * 移出并获取列表的第一个元素 | |
680 | + * | |
681 | + * @param key key | |
682 | + * @return 删除的元素 | |
683 | + */ | |
684 | + public String lLeftPop(String key) { | |
685 | + return redisTemplate.opsForList().leftPop(key); | |
686 | + } | |
687 | + | |
688 | + /** | |
689 | + * 移出并获取列表的第一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 | |
690 | + * | |
691 | + * @param key key | |
692 | + * @param timeout 等待时间 | |
693 | + * @param unit 时间单位 | |
694 | + * @return | |
695 | + */ | |
696 | + public String lbLeftPop(String key, long timeout, TimeUnit unit) { | |
697 | + return redisTemplate.opsForList().leftPop(key, timeout, unit); | |
698 | + } | |
699 | + | |
700 | + /** | |
701 | + * 移除并获取列表最后一个元素 | |
702 | + * | |
703 | + * @param key key | |
704 | + * @return 删除的元素 | |
705 | + */ | |
706 | + public String lRightPop(String key) { | |
707 | + return redisTemplate.opsForList().rightPop(key); | |
708 | + } | |
709 | + | |
710 | + /** | |
711 | + * 移出并获取列表的最后一个元素, 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 | |
712 | + * | |
713 | + * @param key key | |
714 | + * @param timeout 等待时间 | |
715 | + * @param unit 时间单位 | |
716 | + * @return | |
717 | + */ | |
718 | + public String lbRightPop(String key, long timeout, TimeUnit unit) { | |
719 | + return redisTemplate.opsForList().rightPop(key, timeout, unit); | |
720 | + } | |
721 | + | |
722 | + /** | |
723 | + * 移除列表的最后一个元素,并将该元素添加到另一个列表并返回 | |
724 | + * | |
725 | + * @param sourceKey | |
726 | + * @param destinationKey | |
727 | + * @return | |
728 | + */ | |
729 | + public String lRightPopAndLeftPush(String sourceKey, String destinationKey) { | |
730 | + return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey); | |
731 | + } | |
732 | + | |
733 | + /** | |
734 | + * 从列表中弹出一个值,将弹出的元素插入到另外一个列表中并返回它; 如果列表没有元素会阻塞列表直到等待超时或发现可弹出元素为止 | |
735 | + * | |
736 | + * @param sourceKey | |
737 | + * @param destinationKey | |
738 | + * @param timeout | |
739 | + * @param unit | |
740 | + * @return | |
741 | + */ | |
742 | + public String lbRightPopAndLeftPush(String sourceKey, String destinationKey, | |
743 | + long timeout, TimeUnit unit) { | |
744 | + return redisTemplate.opsForList().rightPopAndLeftPush(sourceKey, destinationKey, timeout, unit); | |
745 | + } | |
746 | + | |
747 | + /** | |
748 | + * 删除集合中值等于value得元素 | |
749 | + * | |
750 | + * @param key key | |
751 | + * @param index index=0, 删除所有值等于value的元素; index>0, 从头部开始删除第一个值等于value的元素; | |
752 | + * index<0, 从尾部开始删除第一个值等于value的元素; | |
753 | + * @param value val | |
754 | + * @return | |
755 | + */ | |
756 | + public Long lRemove(String key, long index, String value) { | |
757 | + return redisTemplate.opsForList().remove(key, index, value); | |
758 | + } | |
759 | + | |
760 | + /** | |
761 | + * 裁剪list | |
762 | + * | |
763 | + * @param key key | |
764 | + * @param start | |
765 | + * @param end | |
766 | + */ | |
767 | + public void lTrim(String key, long start, long end) { | |
768 | + redisTemplate.opsForList().trim(key, start, end); | |
769 | + } | |
770 | + | |
771 | + /** | |
772 | + * 获取列表长度 | |
773 | + * | |
774 | + * @param key key | |
775 | + * @return | |
776 | + */ | |
777 | + public Long lLen(String key) { | |
778 | + return redisTemplate.opsForList().size(key); | |
779 | + } | |
780 | + | |
781 | + /** --------------------set相关操作-------------------------- */ | |
782 | + | |
783 | + /** | |
784 | + * set添加元素 | |
785 | + * | |
786 | + * @param key key | |
787 | + * @param values vals | |
788 | + * @return | |
789 | + */ | |
790 | + public Long sAdd(String key, String... values) { | |
791 | + return redisTemplate.opsForSet().add(key, values); | |
792 | + } | |
793 | + | |
794 | + /** | |
795 | + * set移除元素 | |
796 | + * | |
797 | + * @param key key | |
798 | + * @param values vals | |
799 | + * @return | |
800 | + */ | |
801 | + public Long sRemove(String key, Object... values) { | |
802 | + return redisTemplate.opsForSet().remove(key, values); | |
803 | + } | |
804 | + | |
805 | + /** | |
806 | + * 移除并返回集合的一个随机元素 | |
807 | + * | |
808 | + * @param key key | |
809 | + * @return | |
810 | + */ | |
811 | + public String sPop(String key) { | |
812 | + return redisTemplate.opsForSet().pop(key); | |
813 | + } | |
814 | + | |
815 | + /** | |
816 | + * 移除并返回集合的多个随机元素 | |
817 | + * | |
818 | + * @param key key | |
819 | + * @return | |
820 | + */ | |
821 | + public List<String> sPop(String key, int count) { | |
822 | + return redisTemplate.opsForSet().pop(key, count); | |
823 | + } | |
824 | + | |
825 | + /** | |
826 | + * 将元素value从一个集合移到另一个集合 | |
827 | + * | |
828 | + * @param key key | |
829 | + * @param value val | |
830 | + * @param destKey | |
831 | + * @return | |
832 | + */ | |
833 | + public Boolean sMove(String key, String value, String destKey) { | |
834 | + return redisTemplate.opsForSet().move(key, value, destKey); | |
835 | + } | |
836 | + | |
837 | + /** | |
838 | + * 获取集合的大小 | |
839 | + * | |
840 | + * @param key key | |
841 | + * @return | |
842 | + */ | |
843 | + public Long sSize(String key) { | |
844 | + return redisTemplate.opsForSet().size(key); | |
845 | + } | |
846 | + | |
847 | + /** | |
848 | + * 判断集合是否包含value | |
849 | + * | |
850 | + * @param key key | |
851 | + * @param value val | |
852 | + * @return | |
853 | + */ | |
854 | + public Boolean sIsMember(String key, Object value) { | |
855 | + return redisTemplate.opsForSet().isMember(key, value); | |
856 | + } | |
857 | + | |
858 | + /** | |
859 | + * 获取两个集合的交集 | |
860 | + * | |
861 | + * @param key key | |
862 | + * @param otherKey | |
863 | + * @return | |
864 | + */ | |
865 | + public Set<String> sIntersect(String key, String otherKey) { | |
866 | + return redisTemplate.opsForSet().intersect(key, otherKey); | |
867 | + } | |
868 | + | |
869 | + /** | |
870 | + * 获取key集合与多个集合的交集 | |
871 | + * | |
872 | + * @param key key | |
873 | + * @param otherKeys | |
874 | + * @return | |
875 | + */ | |
876 | + public Set<String> sIntersect(String key, Collection<String> otherKeys) { | |
877 | + return redisTemplate.opsForSet().intersect(key, otherKeys); | |
878 | + } | |
879 | + | |
880 | + /** | |
881 | + * key集合与otherKey集合的交集存储到destKey集合中 | |
882 | + * | |
883 | + * @param key key | |
884 | + * @param otherKey | |
885 | + * @param destKey | |
886 | + * @return | |
887 | + */ | |
888 | + public Long sIntersectAndStore(String key, String otherKey, String destKey) { | |
889 | + return redisTemplate.opsForSet().intersectAndStore(key, otherKey, destKey); | |
890 | + } | |
891 | + | |
892 | + /** | |
893 | + * key集合与多个集合的交集存储到destKey集合中 | |
894 | + * | |
895 | + * @param key key | |
896 | + * @param otherKeys | |
897 | + * @param destKey | |
898 | + * @return | |
899 | + */ | |
900 | + public Long sIntersectAndStore(String key, Collection<String> otherKeys, String destKey) { | |
901 | + return redisTemplate.opsForSet().intersectAndStore(key, otherKeys, destKey); | |
902 | + } | |
903 | + | |
904 | + /** | |
905 | + * 获取两个集合的并集 | |
906 | + * | |
907 | + * @param key key | |
908 | + * @param otherKeys | |
909 | + * @return | |
910 | + */ | |
911 | + public Set<String> sUnion(String key, String otherKeys) { | |
912 | + return redisTemplate.opsForSet().union(key, otherKeys); | |
913 | + } | |
914 | + | |
915 | + /** | |
916 | + * 获取key集合与多个集合的并集 | |
917 | + * | |
918 | + * @param key key | |
919 | + * @param otherKeys | |
920 | + * @return | |
921 | + */ | |
922 | + public Set<String> sUnion(String key, Collection<String> otherKeys) { | |
923 | + return redisTemplate.opsForSet().union(key, otherKeys); | |
924 | + } | |
925 | + | |
926 | + /** | |
927 | + * key集合与otherKey集合的并集存储到destKey中 | |
928 | + * | |
929 | + * @param key key | |
930 | + * @param otherKey | |
931 | + * @param destKey | |
932 | + * @return | |
933 | + */ | |
934 | + public Long sUnionAndStore(String key, String otherKey, String destKey) { | |
935 | + return redisTemplate.opsForSet().unionAndStore(key, otherKey, destKey); | |
936 | + } | |
937 | + | |
938 | + /** | |
939 | + * key集合与多个集合的并集存储到destKey中 | |
940 | + * | |
941 | + * @param key key | |
942 | + * @param otherKeys | |
943 | + * @param destKey | |
944 | + * @return | |
945 | + */ | |
946 | + public Long sUnionAndStore(String key, Collection<String> otherKeys, String destKey) { | |
947 | + return redisTemplate.opsForSet().unionAndStore(key, otherKeys, destKey); | |
948 | + } | |
949 | + | |
950 | + /** | |
951 | + * 获取两个集合的差集 | |
952 | + * | |
953 | + * @param key key | |
954 | + * @param otherKey | |
955 | + * @return | |
956 | + */ | |
957 | + public Set<String> sDifference(String key, String otherKey) { | |
958 | + return redisTemplate.opsForSet().difference(key, otherKey); | |
959 | + } | |
960 | + | |
961 | + /** | |
962 | + * 获取key集合与多个集合的差集 | |
963 | + * | |
964 | + * @param key key | |
965 | + * @param otherKeys | |
966 | + * @return | |
967 | + */ | |
968 | + public Set<String> sDifference(String key, Collection<String> otherKeys) { | |
969 | + return redisTemplate.opsForSet().difference(key, otherKeys); | |
970 | + } | |
971 | + | |
972 | + /** | |
973 | + * key集合与otherKey集合的差集存储到destKey中 | |
974 | + * | |
975 | + * @param key key | |
976 | + * @param otherKey | |
977 | + * @param destKey | |
978 | + * @return | |
979 | + */ | |
980 | + public Long sDifference(String key, String otherKey, String destKey) { | |
981 | + return redisTemplate.opsForSet().differenceAndStore(key, otherKey, destKey); | |
982 | + } | |
983 | + | |
984 | + /** | |
985 | + * key集合与多个集合的差集存储到destKey中 | |
986 | + * | |
987 | + * @param key key | |
988 | + * @param otherKeys | |
989 | + * @param destKey | |
990 | + * @return | |
991 | + */ | |
992 | + public Long sDifference(String key, Collection<String> otherKeys, String destKey) { | |
993 | + return redisTemplate.opsForSet().differenceAndStore(key, otherKeys, destKey); | |
994 | + } | |
995 | + | |
996 | + /** | |
997 | + * 获取集合所有元素 | |
998 | + * | |
999 | + * @param key key | |
1000 | + * @param | |
1001 | + * @param | |
1002 | + * @return | |
1003 | + */ | |
1004 | + public Set<String> setMembers(String key) { | |
1005 | + return redisTemplate.opsForSet().members(key); | |
1006 | + } | |
1007 | + | |
1008 | + /** | |
1009 | + * 随机获取集合中的一个元素 | |
1010 | + * | |
1011 | + * @param key key | |
1012 | + * @return | |
1013 | + */ | |
1014 | + public String sRandomMember(String key) { | |
1015 | + return redisTemplate.opsForSet().randomMember(key); | |
1016 | + } | |
1017 | + | |
1018 | + /** | |
1019 | + * 随机获取集合中count个元素 | |
1020 | + * | |
1021 | + * @param key key | |
1022 | + * @param count | |
1023 | + * @return | |
1024 | + */ | |
1025 | + public List<String> sRandomMembers(String key, long count) { | |
1026 | + return redisTemplate.opsForSet().randomMembers(key, count); | |
1027 | + } | |
1028 | + | |
1029 | + /** | |
1030 | + * 随机获取集合中count个元素并且去除重复的 | |
1031 | + * | |
1032 | + * @param key key | |
1033 | + * @param count | |
1034 | + * @return | |
1035 | + */ | |
1036 | + public Set<String> sDistinctRandomMembers(String key, long count) { | |
1037 | + return redisTemplate.opsForSet().distinctRandomMembers(key, count); | |
1038 | + } | |
1039 | + | |
1040 | + /** | |
1041 | + * @param key key | |
1042 | + * @param options | |
1043 | + * @return | |
1044 | + */ | |
1045 | + public Cursor<String> sScan(String key, ScanOptions options) { | |
1046 | + return redisTemplate.opsForSet().scan(key, options); | |
1047 | + } | |
1048 | + | |
1049 | + /**------------------zSet相关操作--------------------------------*/ | |
1050 | + | |
1051 | + /** | |
1052 | + * 添加元素,有序集合是按照元素的score值由小到大排列 | |
1053 | + * | |
1054 | + * @param key key | |
1055 | + * @param value val | |
1056 | + * @param score | |
1057 | + * @return | |
1058 | + */ | |
1059 | + public Boolean zAdd(String key, String value, double score) { | |
1060 | + return redisTemplate.opsForZSet().add(key, value, score); | |
1061 | + } | |
1062 | + | |
1063 | + /** | |
1064 | + * @param key key | |
1065 | + * @param values val | |
1066 | + * @return | |
1067 | + */ | |
1068 | + public Long zAdd(String key, Set<ZSetOperations.TypedTuple<String>> values) { | |
1069 | + return redisTemplate.opsForZSet().add(key, values); | |
1070 | + } | |
1071 | + | |
1072 | + /** | |
1073 | + * @param key key | |
1074 | + * @param values val | |
1075 | + * @return 已删除元素的数量 | |
1076 | + */ | |
1077 | + public Long zRemove(String key, Object... values) { | |
1078 | + return redisTemplate.opsForZSet().remove(key, values); | |
1079 | + } | |
1080 | + | |
1081 | + /** | |
1082 | + * 增加元素的score值,并返回增加后的值 | |
1083 | + * | |
1084 | + * @param key key | |
1085 | + * @param value val | |
1086 | + * @param delta 分数值 | |
1087 | + * @return 增加后的值 | |
1088 | + */ | |
1089 | + public Double zIncrementScore(String key, String value, double delta) { | |
1090 | + return redisTemplate.opsForZSet().incrementScore(key, value, delta); | |
1091 | + } | |
1092 | + | |
1093 | + /** | |
1094 | + * 返回元素在集合的排名,有序集合是按照元素的score值由小到大排列 | |
1095 | + * | |
1096 | + * @param key key | |
1097 | + * @param value val | |
1098 | + * @return 0表示第一位 | |
1099 | + */ | |
1100 | + public Long zRank(String key, Object value) { | |
1101 | + return redisTemplate.opsForZSet().rank(key, value); | |
1102 | + | |
1103 | + } | |
1104 | + | |
1105 | + /** | |
1106 | + * 返回元素在集合的排名,按元素的score值由大到小排列 | |
1107 | + * | |
1108 | + * @param key key | |
1109 | + * @param value val | |
1110 | + */ | |
1111 | + public Long zReverseRank(String key, Object value) { | |
1112 | + return redisTemplate.opsForZSet().reverseRank(key, value); | |
1113 | + } | |
1114 | + | |
1115 | + /** | |
1116 | + * 获取集合的元素, 从小到大排序 | |
1117 | + * | |
1118 | + * @param key key | |
1119 | + * @param start 开始位置 | |
1120 | + * @param end 结束位置, -1查询所有 | |
1121 | + */ | |
1122 | + public Set<String> zRange(String key, long start, long end) { | |
1123 | + return redisTemplate.opsForZSet().range(key, start, end); | |
1124 | + } | |
1125 | + | |
1126 | + /** | |
1127 | + * 获取集合元素, 并且把score值也获取 | |
1128 | + * | |
1129 | + * @param key key | |
1130 | + * @param start | |
1131 | + * @param end | |
1132 | + * @return | |
1133 | + */ | |
1134 | + public Set<ZSetOperations.TypedTuple<String>> zRangeWithScores(String key, long start, long end) { | |
1135 | + return redisTemplate.opsForZSet().rangeWithScores(key, start, end); | |
1136 | + } | |
1137 | + | |
1138 | + /** | |
1139 | + * 根据Score值查询集合元素 | |
1140 | + * | |
1141 | + * @param key key | |
1142 | + * @param min 最小值 | |
1143 | + * @param max 最大值 | |
1144 | + * @return | |
1145 | + */ | |
1146 | + public Set<String> zRangeByScore(String key, double min, double max) { | |
1147 | + return redisTemplate.opsForZSet().rangeByScore(key, min, max); | |
1148 | + } | |
1149 | + | |
1150 | + /** | |
1151 | + * 根据Score值查询集合元素, 从小到大排序 | |
1152 | + * | |
1153 | + * @param key key | |
1154 | + * @param min 最小值 | |
1155 | + * @param max 最大值 | |
1156 | + * @return | |
1157 | + */ | |
1158 | + public Set<ZSetOperations.TypedTuple<String>> zRangeByScoreWithScores(String key, | |
1159 | + double min, double max) { | |
1160 | + return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max); | |
1161 | + } | |
1162 | + | |
1163 | + /** | |
1164 | + * @param key key | |
1165 | + * @param min | |
1166 | + * @param max | |
1167 | + * @param start | |
1168 | + * @param end | |
1169 | + * @return | |
1170 | + */ | |
1171 | + public Set<ZSetOperations.TypedTuple<String>> zRangeByScoreWithScores(String key, double min, double max, long start, long end) { | |
1172 | + return redisTemplate.opsForZSet().rangeByScoreWithScores(key, min, max, start, end); | |
1173 | + } | |
1174 | + | |
1175 | + /** | |
1176 | + * 获取集合的元素, 从大到小排序 | |
1177 | + * | |
1178 | + * @param key key | |
1179 | + * @param start | |
1180 | + * @param end | |
1181 | + * @return | |
1182 | + */ | |
1183 | + public Set<String> zReverseRange(String key, long start, long end) { | |
1184 | + return redisTemplate.opsForZSet().reverseRange(key, start, end); | |
1185 | + } | |
1186 | + | |
1187 | + /** | |
1188 | + * 获取集合的元素, 从大到小排序, 并返回score值 | |
1189 | + * | |
1190 | + * @param key key | |
1191 | + * @param start | |
1192 | + * @param end | |
1193 | + * @return | |
1194 | + */ | |
1195 | + public Set<ZSetOperations.TypedTuple<String>> zReverseRangeWithScores(String key, | |
1196 | + long start, long end) { | |
1197 | + return redisTemplate.opsForZSet().reverseRangeWithScores(key, start, end); | |
1198 | + } | |
1199 | + | |
1200 | + /** | |
1201 | + * 根据Score值查询集合元素, 从大到小排序 | |
1202 | + * | |
1203 | + * @param key key | |
1204 | + * @param min | |
1205 | + * @param max | |
1206 | + * @return | |
1207 | + */ | |
1208 | + public Set<String> zReverseRangeByScore(String key, double min, double max) { | |
1209 | + return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max); | |
1210 | + } | |
1211 | + | |
1212 | + /** | |
1213 | + * 根据Score值查询集合元素, 从大到小排序 | |
1214 | + * | |
1215 | + * @param key key | |
1216 | + * @param min | |
1217 | + * @param max | |
1218 | + * @return | |
1219 | + */ | |
1220 | + public Set<ZSetOperations.TypedTuple<String>> zReverseRangeByScoreWithScores(String key, double min, double max) { | |
1221 | + return redisTemplate.opsForZSet().reverseRangeByScoreWithScores(key, min, max); | |
1222 | + } | |
1223 | + | |
1224 | + /** | |
1225 | + * @param key key | |
1226 | + * @param min | |
1227 | + * @param max | |
1228 | + * @param start | |
1229 | + * @param end | |
1230 | + * @return | |
1231 | + */ | |
1232 | + public Set<String> zReverseRangeByScore(String key, double min, | |
1233 | + double max, long start, long end) { | |
1234 | + return redisTemplate.opsForZSet().reverseRangeByScore(key, min, max, start, end); | |
1235 | + } | |
1236 | + | |
1237 | + /** | |
1238 | + * 根据score值获取集合元素数量 | |
1239 | + * | |
1240 | + * @param key key | |
1241 | + * @param min | |
1242 | + * @param max | |
1243 | + * @return | |
1244 | + */ | |
1245 | + public Long zCount(String key, double min, double max) { | |
1246 | + return redisTemplate.opsForZSet().count(key, min, max); | |
1247 | + } | |
1248 | + | |
1249 | + /** | |
1250 | + * 获取集合大小 | |
1251 | + * | |
1252 | + * @param key key | |
1253 | + * @return | |
1254 | + */ | |
1255 | + public Long zSize(String key) { | |
1256 | + return redisTemplate.opsForZSet().size(key); | |
1257 | + } | |
1258 | + | |
1259 | + /** | |
1260 | + * 获取集合大小 | |
1261 | + * | |
1262 | + * @param key key | |
1263 | + * @return | |
1264 | + */ | |
1265 | + public Long zzCard(String key) { | |
1266 | + return redisTemplate.opsForZSet().zCard(key); | |
1267 | + } | |
1268 | + | |
1269 | + /** | |
1270 | + * 获取集合中value元素的score值 | |
1271 | + * | |
1272 | + * @param key key | |
1273 | + * @param value val | |
1274 | + * @return | |
1275 | + */ | |
1276 | + public Double zScore(String key, Object value) { | |
1277 | + return redisTemplate.opsForZSet().score(key, value); | |
1278 | + } | |
1279 | + | |
1280 | + /** | |
1281 | + * 移除指定索引位置的成员 | |
1282 | + * | |
1283 | + * @param key key | |
1284 | + * @param start | |
1285 | + * @param end | |
1286 | + * @return | |
1287 | + */ | |
1288 | + public Long zRemoveRange(String key, long start, long end) { | |
1289 | + return redisTemplate.opsForZSet().removeRange(key, start, end); | |
1290 | + } | |
1291 | + | |
1292 | + /** | |
1293 | + * 根据指定的score值的范围来移除成员 | |
1294 | + * | |
1295 | + * @param key key | |
1296 | + * @param min | |
1297 | + * @param max | |
1298 | + * @return | |
1299 | + */ | |
1300 | + public Long zRemoveRangeByScore(String key, double min, double max) { | |
1301 | + return redisTemplate.opsForZSet().removeRangeByScore(key, min, max); | |
1302 | + } | |
1303 | + | |
1304 | + /** | |
1305 | + * 获取key和otherKey的并集并存储在destKey中 | |
1306 | + * | |
1307 | + * @param key key | |
1308 | + * @param otherKey | |
1309 | + * @param destKey | |
1310 | + * @return | |
1311 | + */ | |
1312 | + public Long zUnionAndStore(String key, String otherKey, String destKey) { | |
1313 | + return redisTemplate.opsForZSet().unionAndStore(key, otherKey, destKey); | |
1314 | + } | |
1315 | + | |
1316 | + /** | |
1317 | + * @param key key | |
1318 | + * @param otherKeys | |
1319 | + * @param destKey | |
1320 | + * @return | |
1321 | + */ | |
1322 | + public Long zUnionAndStore(String key, Collection<String> otherKeys, String destKey) { | |
1323 | + return redisTemplate.opsForZSet().unionAndStore(key, otherKeys, destKey); | |
1324 | + } | |
1325 | + | |
1326 | + /** | |
1327 | + * 交集 | |
1328 | + * | |
1329 | + * @param key key | |
1330 | + * @param otherKey | |
1331 | + * @param destKey | |
1332 | + * @return | |
1333 | + */ | |
1334 | + public Long zIntersectAndStore(String key, String otherKey, String destKey) { | |
1335 | + return redisTemplate.opsForZSet().intersectAndStore(key, otherKey, destKey); | |
1336 | + } | |
1337 | + | |
1338 | + /** | |
1339 | + * 交集 | |
1340 | + * | |
1341 | + * @param key key | |
1342 | + * @param otherKeys | |
1343 | + * @param destKey | |
1344 | + * @return | |
1345 | + */ | |
1346 | + public Long zIntersectAndStore(String key, Collection<String> otherKeys, String destKey) { | |
1347 | + return redisTemplate.opsForZSet().intersectAndStore(key, otherKeys, destKey); | |
1348 | + } | |
1349 | + | |
1350 | + /** | |
1351 | + * @param key key | |
1352 | + * @param options | |
1353 | + * @return | |
1354 | + */ | |
1355 | + public Cursor<ZSetOperations.TypedTuple<String>> zScan(String key, ScanOptions options) { | |
1356 | + return redisTemplate.opsForZSet().scan(key, options); | |
1357 | + } | |
1358 | + | |
1359 | + /* -------------------锁相关操作--------------------- */ | |
1360 | + | |
1361 | + | |
1362 | + /** | |
1363 | + * 获得锁 | |
1364 | + */ | |
1365 | + public boolean getLock(String lockId, String value, long millisecond) { | |
1366 | + Boolean success = redisTemplate.opsForValue().setIfAbsent(lockId, value, millisecond, TimeUnit.MILLISECONDS); | |
1367 | + return success != null && success; | |
1368 | + } | |
1369 | + | |
1370 | + /** | |
1371 | + * 获得锁,并自旋,返回 | |
1372 | + */ | |
1373 | + public boolean getLock(String lockId, String value, long millisecond, long timeout) { | |
1374 | + long start = System.currentTimeMillis(); | |
1375 | + do { | |
1376 | + boolean success = getLock(lockId, value, millisecond); | |
1377 | + if (success) { | |
1378 | + return true; | |
1379 | + } | |
1380 | + try { | |
1381 | + Thread.sleep(100); | |
1382 | + } catch (InterruptedException e) { | |
1383 | + e.printStackTrace(); | |
1384 | + } | |
1385 | + } while (System.currentTimeMillis() - start < timeout); | |
1386 | + return false; | |
1387 | + } | |
1388 | + | |
1389 | + /** | |
1390 | + * 释放锁 | |
1391 | + */ | |
1392 | + public void releaseLock(String id, String lockValue) { | |
1393 | + if (StringUtils.isNotEmpty(lockValue) && lockValue.equals(this.get(id))) { | |
1394 | + log.debug("RedisUtil releaseLock, key: {}, value: {}", id, lockValue); | |
1395 | + redisTemplate.delete(id); | |
1396 | + } | |
1397 | + } | |
1398 | + | |
1399 | + /* -------------------HyperLogLog相关操作--------------------- */ | |
1400 | + | |
1401 | + /** | |
1402 | + * HyperLogLog 添加元素 | |
1403 | + * <p> key不存在则新增 | |
1404 | + * | |
1405 | + * @param key key | |
1406 | + * @param value value集合 | |
1407 | + * @return true表示加入成功 | |
1408 | + * @author A80080 | |
1409 | + * @createDate 2021/3/26 | |
1410 | + */ | |
1411 | + public boolean pfAdd(String key, String... value) { | |
1412 | + return redisTemplate.opsForHyperLogLog().add(key, value) == 1; | |
1413 | + } | |
1414 | + | |
1415 | + /** | |
1416 | + * HyperLogLog 统计key中元素个数 | |
1417 | + * <p> key 不存在则返回0 | |
1418 | + * | |
1419 | + * @param key key | |
1420 | + * @return key中数据大小(基数统计存在误差) | |
1421 | + * @author A80080 | |
1422 | + * @createDate 2021/3/26 | |
1423 | + */ | |
1424 | + public Long pfCount(String key) { | |
1425 | + return redisTemplate.opsForHyperLogLog().size(key); | |
1426 | + } | |
1427 | + | |
1428 | + /** | |
1429 | + * 合并HyperLogLog key,并统计新key元素个数 | |
1430 | + * <p>不删除参与合并的key; 新key不存在则新增, | |
1431 | + * | |
1432 | + * @param destination 合并后的key名称 | |
1433 | + * @param sourceKeys 参与合并的key | |
1434 | + * @return 合并后的key元素个数 | |
1435 | + * @author A80080 | |
1436 | + * @createDate 2021/3/26 | |
1437 | + */ | |
1438 | + public Long pfMerge(String destination, String... sourceKeys) { | |
1439 | + return redisTemplate.opsForHyperLogLog().union(destination, sourceKeys); | |
1440 | + } | |
1441 | + | |
1442 | + | |
1443 | +} | |
0 | 1444 | \ No newline at end of file | ... | ... |
src/main/java/com/order/erp/common/utils/RequestStringUtils.java
1 | 1 | package com.order.erp.common.utils; |
2 | 2 | |
3 | 3 | import cn.hutool.core.io.resource.ClassPathResource; |
4 | -import com.canrd.shop.common.constant.ElAdminConstant; | |
4 | +import com.order.erp.common.constant.ElAdminConstant; | |
5 | 5 | import eu.bitwalker.useragentutils.Browser; |
6 | 6 | import eu.bitwalker.useragentutils.UserAgent; |
7 | 7 | import org.lionsoul.ip2region.DataBlock; | ... | ... |
src/main/java/com/order/erp/common/utils/ServletUtils.java
1 | 1 | package com.order.erp.common.utils; |
2 | 2 | |
3 | -import com.canrd.shop.common.constant.ServerResult; | |
3 | +import com.order.erp.common.constant.ServerResult; | |
4 | 4 | import lombok.extern.slf4j.Slf4j; |
5 | 5 | import org.springframework.http.HttpStatus; |
6 | 6 | |
... | ... | @@ -14,31 +14,27 @@ import java.io.IOException; |
14 | 14 | public class ServletUtils { |
15 | 15 | |
16 | 16 | |
17 | - public static void renderServerResult(HttpServletResponse response, ServerResult serverResult, HttpStatus httpStatus) | |
18 | - { | |
19 | - try | |
20 | - { | |
17 | + public static void renderServerResult(HttpServletResponse response, ServerResult serverResult, HttpStatus httpStatus) { | |
18 | + try { | |
21 | 19 | response.setStatus(httpStatus.value()); |
22 | 20 | response.setContentType("application/json"); |
23 | 21 | response.setCharacterEncoding("utf-8"); |
24 | 22 | response.getWriter().print(JsonUtil.toJsonString(serverResult)); |
25 | - } | |
26 | - catch (IOException e) | |
27 | - { | |
28 | - log.error("ServletUtils#renderServerResult:",e); | |
23 | + } catch (IOException e) { | |
24 | + log.error("ServletUtils#renderServerResult:", e); | |
29 | 25 | } |
30 | 26 | } |
31 | 27 | |
32 | 28 | |
33 | - public static void renderExcelFileNotFound(HttpServletResponse response){ | |
29 | + public static void renderExcelFileNotFound(HttpServletResponse response) { | |
34 | 30 | try { |
35 | 31 | response.setStatus(404); |
36 | 32 | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
37 | 33 | //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码 |
38 | 34 | response.setHeader("Content-Disposition", "attachment;filename=file.xlsx"); |
39 | - response.sendError(HttpStatus.NOT_FOUND.value(),"下载失败,资源不存在"); | |
40 | - }catch (IOException e){ | |
41 | - log.error("ServletUtils#renderWithResourceNotFound:",e); | |
35 | + response.sendError(HttpStatus.NOT_FOUND.value(), "下载失败,资源不存在"); | |
36 | + } catch (IOException e) { | |
37 | + log.error("ServletUtils#renderWithResourceNotFound:", e); | |
42 | 38 | } |
43 | 39 | } |
44 | 40 | } | ... | ... |
src/main/java/com/order/erp/common/utils/SmsUtils.java
0 → 100644
1 | +package com.order.erp.common.utils; | |
2 | + | |
3 | +import com.alibaba.fastjson.JSONObject; | |
4 | +import com.aliyuncs.CommonRequest; | |
5 | +import com.aliyuncs.CommonResponse; | |
6 | +import com.aliyuncs.DefaultAcsClient; | |
7 | +import com.aliyuncs.IAcsClient; | |
8 | +import com.aliyuncs.http.MethodType; | |
9 | +import com.aliyuncs.profile.DefaultProfile; | |
10 | +import com.canrd.shop.common.constant.ServerResultCode; | |
11 | +import com.google.common.collect.Maps; | |
12 | +import com.order.erp.common.constant.Constant; | |
13 | +import com.order.erp.common.constant.ServerResult; | |
14 | +import com.order.erp.common.exception.BusinessException; | |
15 | +import com.order.erp.domain.vo.CaptchaMessageVO; | |
16 | +import lombok.extern.slf4j.Slf4j; | |
17 | +import org.springframework.beans.factory.annotation.Value; | |
18 | +import org.springframework.stereotype.Service; | |
19 | + | |
20 | +import javax.annotation.Resource; | |
21 | +import java.time.LocalDateTime; | |
22 | +import java.util.*; | |
23 | +import java.util.concurrent.TimeUnit; | |
24 | + | |
25 | + | |
26 | +@Slf4j | |
27 | +@Service | |
28 | +public class SmsUtils { | |
29 | + | |
30 | + | |
31 | + @Value("${outsys.sms.regionId}") | |
32 | + private String regionId; | |
33 | + | |
34 | + @Value("${outsys.sms.accessKeyId}") | |
35 | + private String accessKeyId; | |
36 | + | |
37 | + @Value("${outsys.sms.secret}") | |
38 | + private String secret; | |
39 | + | |
40 | + @Value("${outsys.sms.domain}") | |
41 | + private String domain; | |
42 | + | |
43 | + @Value("${outsys.sms.version}") | |
44 | + private String version; | |
45 | + | |
46 | + @Value("${outsys.sms.action}") | |
47 | + private String action; | |
48 | + | |
49 | + @Value("${outsys.sms.signName}") | |
50 | + private String signName; | |
51 | + | |
52 | + @Value("${outsys.sms.templateCode}") | |
53 | + private String templateCode; | |
54 | + | |
55 | + @Resource | |
56 | + private RedisUtil redisUtil; | |
57 | + | |
58 | + @Resource | |
59 | + private ImgCaptchaUtils imgCaptchaUtils; | |
60 | + | |
61 | + /** | |
62 | + * 短信验证码前缀 + 手机号码 | |
63 | + * 1分钟有效 | |
64 | + */ | |
65 | + private static String SMS_CODE_KEY_PRE = "SMS_CODE_%s"; | |
66 | + | |
67 | + | |
68 | + /** | |
69 | + * 发送短信验证码 | |
70 | + * | |
71 | + * @param captchaMessageVO | |
72 | + * @return | |
73 | + */ | |
74 | + public ServerResult sendCaptchaCode(CaptchaMessageVO captchaMessageVO) { | |
75 | + String phone = captchaMessageVO.getPhone(); | |
76 | + | |
77 | + imgCaptchaUtils.validateImgCaptcha(captchaMessageVO.getImgCaptchaCode(), captchaMessageVO.getImgCaptchaUuid()); | |
78 | + | |
79 | + if (checkLimitMobileSendCount(phone)) { | |
80 | + return ServerResult.fail(ServerResultCode.SMS_SEND_OVER_LIMIT_ERROR); | |
81 | + } | |
82 | + String captchaCode = getCaptchaCode(phone); | |
83 | + ServerResult serverResult = send(buildSmsMessageVO(phone, captchaCode)); | |
84 | + if (serverResult.checkNotSuccess()) { | |
85 | + return serverResult; | |
86 | + } | |
87 | + setSmsCaptchaCode(phone, captchaCode); | |
88 | + return serverResult; | |
89 | + } | |
90 | + | |
91 | + /** | |
92 | + * 获取发送的短信验证码 | |
93 | + * | |
94 | + * @param phone | |
95 | + * @param captchaCode | |
96 | + * @return | |
97 | + */ | |
98 | + private void setSmsCaptchaCode(String phone, String captchaCode) { | |
99 | + redisUtil.set(String.format(SMS_CODE_KEY_PRE, phone), captchaCode, 1L, TimeUnit.MINUTES); | |
100 | + } | |
101 | + | |
102 | + /** | |
103 | + * 获取发送的短信验证码 | |
104 | + * | |
105 | + * @param phone | |
106 | + * @return | |
107 | + */ | |
108 | + private String getSmsCaptchaCode(String phone) { | |
109 | + return redisUtil.get(String.format(SMS_CODE_KEY_PRE, phone)); | |
110 | + } | |
111 | + | |
112 | + /** | |
113 | + * @param phone | |
114 | + */ | |
115 | + private void deleteSmsCaptchaCode(String phone) { | |
116 | + redisUtil.delete(String.format(SMS_CODE_KEY_PRE, phone)); | |
117 | + } | |
118 | + | |
119 | + /** | |
120 | + * @param phone | |
121 | + * @param smsCaptchaCode | |
122 | + */ | |
123 | + public void validateSmsCaptcha(String phone, String smsCaptchaCode) { | |
124 | + // 查询验证码 | |
125 | + String code = getSmsCaptchaCode(phone); | |
126 | + // 清除验证码 | |
127 | + deleteSmsCaptchaCode(phone); | |
128 | + if (StringUtils.isBlank(code)) { | |
129 | + throw new BusinessException(ServerResultCode.SMS_CAPTCHA_ERROR); | |
130 | + } | |
131 | + if (StringUtils.isBlank(smsCaptchaCode) || !smsCaptchaCode.equalsIgnoreCase(code)) { | |
132 | + throw new BusinessException(ServerResultCode.SMS_CAPTCHA_EXPIRE_ERROR); | |
133 | + } | |
134 | + } | |
135 | + | |
136 | + /** | |
137 | + * @param phone | |
138 | + * @param smsCaptchaCode | |
139 | + */ | |
140 | + public boolean validateSmsCaptchaV2(String phone, String smsCaptchaCode) { | |
141 | + // 查询验证码 | |
142 | + String code = getSmsCaptchaCode(phone); | |
143 | + // 清除验证码 | |
144 | + deleteSmsCaptchaCode(phone); | |
145 | + if (StringUtils.isBlank(code)) { | |
146 | + return false; | |
147 | + } | |
148 | + if (StringUtils.isBlank(smsCaptchaCode) || !smsCaptchaCode.equalsIgnoreCase(code)) { | |
149 | + return false; | |
150 | + } | |
151 | + return true; | |
152 | + } | |
153 | + | |
154 | + /** | |
155 | + * @param phone | |
156 | + * @param captchaCode | |
157 | + * @return | |
158 | + */ | |
159 | + private CommonRequest buildSmsMessageVO(String phone, String captchaCode) { | |
160 | + CommonRequest request = new CommonRequest(); | |
161 | + request.setMethod(MethodType.POST); | |
162 | + request.setDomain(domain); | |
163 | + request.setVersion(version); | |
164 | + request.setAction(action); | |
165 | + request.putQueryParameter("RegionId", regionId); | |
166 | + StringBuilder builder = new StringBuilder(); | |
167 | + int index = 0; | |
168 | + List<String> phoneNumbers = Arrays.asList(phone); | |
169 | + for (String phoneNumber : phoneNumbers) { | |
170 | + builder.append(phoneNumber + ((index++ < phoneNumbers.size() - 1) ? "," : "")); | |
171 | + } | |
172 | + request.putQueryParameter("PhoneNumbers", builder.toString()); | |
173 | + request.putQueryParameter("SignName", signName); | |
174 | + request.putQueryParameter("TemplateCode", templateCode); | |
175 | + Map<String, String> templateParam = Maps.newHashMap(); | |
176 | + templateParam.put("code", captchaCode); | |
177 | + String templateParamJson = JSONObject.toJSONString(templateParam); | |
178 | + request.putQueryParameter("TemplateParam", templateParamJson); | |
179 | + log.info("开始发送短信,手机号 {},captchaCode:{}", phone, captchaCode); | |
180 | + return request; | |
181 | + } | |
182 | + | |
183 | + | |
184 | + /** | |
185 | + * 限制一分钟最多发送两次短信 | |
186 | + * | |
187 | + * @param mobile | |
188 | + * @return | |
189 | + */ | |
190 | + private boolean checkLimitMobileSendCount(String mobile) { | |
191 | + String dateTime = DateUtils.format(LocalDateTime.now(), DateUtils.DATE_TIME_WITHOUT_SECONDS); | |
192 | + | |
193 | + String key = "msg:" + mobile + Constant.COLON_CHARACTER + dateTime; | |
194 | + | |
195 | + Long count = redisUtil.incrBy(key, Constant.ONE); | |
196 | + return Objects.nonNull(count) && count > Constant.TWO ? true : false; | |
197 | + } | |
198 | + | |
199 | + /** | |
200 | + * 生成验证码 | |
201 | + * | |
202 | + * @param phone | |
203 | + * @return | |
204 | + */ | |
205 | + public String getCaptchaCode(String phone) { | |
206 | + String src = phone + DateUtils.format(new Date(), DateUtils.YYMMDDHHMMSS); | |
207 | + String code = Math.abs(src.hashCode()) + ""; | |
208 | + if (code.length() >= 4) { | |
209 | + return code.substring(code.length() - 4, code.length()); | |
210 | + } else { | |
211 | + StringBuilder buf = new StringBuilder(code); | |
212 | + while (buf.length() < 4) { | |
213 | + buf.insert(0, "0"); | |
214 | + } | |
215 | + return buf.toString(); | |
216 | + } | |
217 | + } | |
218 | + | |
219 | + | |
220 | + /** | |
221 | + * @param request | |
222 | + * @return | |
223 | + */ | |
224 | + public ServerResult send(CommonRequest request) { | |
225 | + DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, secret); | |
226 | + IAcsClient client = new DefaultAcsClient(profile); | |
227 | + | |
228 | + try { | |
229 | + CommonResponse response = client.getCommonResponse(request); | |
230 | + log.info("短信发送,结果 {}", response.getData()); | |
231 | + } catch (Exception e) { | |
232 | + log.error("短信发送异常:", e); | |
233 | + return ServerResult.fail("短信发送异常:" + e); | |
234 | + } | |
235 | + | |
236 | + return ServerResult.success(); | |
237 | + } | |
238 | + | |
239 | +} | ... | ... |
src/main/java/com/order/erp/common/utils/StringUtils.java
src/main/java/com/order/erp/common/utils/ThrowableUtil.java
1 | 1 | package com.order.erp.common.utils; |
2 | 2 | |
3 | 3 | |
4 | -import com.canrd.shop.common.exception.BadRequestException; | |
4 | +import com.order.erp.common.exception.BusinessException; | |
5 | 5 | |
6 | 6 | import javax.validation.ConstraintViolationException; |
7 | 7 | import java.io.PrintWriter; |
... | ... | @@ -29,9 +29,9 @@ public class ThrowableUtil { |
29 | 29 | t = t.getCause(); |
30 | 30 | } |
31 | 31 | if (t != null) { |
32 | - throw new BadRequestException(msg); | |
32 | + throw new BusinessException(msg); | |
33 | 33 | } |
34 | 34 | assert false; |
35 | - throw new BadRequestException("删除失败:" + t.getMessage()); | |
35 | + throw new BusinessException("删除失败:" + t.getMessage()); | |
36 | 36 | } |
37 | 37 | } | ... | ... |
src/main/java/com/order/erp/controller/CaptchaController.java
0 → 100644
1 | +package com.order.erp.controller; | |
2 | + | |
3 | +import com.order.erp.common.annotation.AnonymousAccess; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.common.utils.ImgCaptchaUtils; | |
6 | +import com.order.erp.common.utils.SmsUtils; | |
7 | +import com.order.erp.domain.vo.CaptchaMessageVO; | |
8 | +import com.wf.captcha.ArithmeticCaptcha; | |
9 | +import org.springframework.validation.annotation.Validated; | |
10 | +import org.springframework.web.bind.annotation.PostMapping; | |
11 | +import org.springframework.web.bind.annotation.RequestBody; | |
12 | +import org.springframework.web.bind.annotation.RequestMapping; | |
13 | +import org.springframework.web.bind.annotation.RestController; | |
14 | + | |
15 | +import javax.annotation.Resource; | |
16 | +import java.util.HashMap; | |
17 | +import java.util.Map; | |
18 | + | |
19 | +/** | |
20 | + * (Member)验证码 | |
21 | + * | |
22 | + * @author makejava | |
23 | + * @since 2023-08-22 17:02:39 | |
24 | + */ | |
25 | +@RestController | |
26 | +@RequestMapping("/order/erp/captcha") | |
27 | +public class CaptchaController { | |
28 | + | |
29 | + @Resource | |
30 | + private SmsUtils smsUtils; | |
31 | + | |
32 | + @Resource | |
33 | + private ImgCaptchaUtils imgCaptchaUtils; | |
34 | + | |
35 | + /** | |
36 | + * 获取验证码 | |
37 | + * | |
38 | + * @param msgVo 查询条件 | |
39 | + * @return 查询结果 | |
40 | + */ | |
41 | + @AnonymousAccess | |
42 | + @PostMapping("/send_captcha_code") | |
43 | + public ServerResult sendCaptchaCode(@RequestBody @Validated CaptchaMessageVO msgVo) { | |
44 | + return smsUtils.sendCaptchaCode(msgVo); | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * 获取图片验证码 | |
49 | + * | |
50 | + * @return 查询结果 | |
51 | + */ | |
52 | + @AnonymousAccess | |
53 | + @PostMapping("/get_img_captcha_code") | |
54 | + public ServerResult getImgCaptchaCode() { | |
55 | + // 算术类型 https://gitee.com/whvse/EasyCaptcha | |
56 | + ArithmeticCaptcha captcha = new ArithmeticCaptcha(111, 36); | |
57 | + // 几位数运算,默认是两位 | |
58 | + captcha.setLen(2); | |
59 | + // 获取运算的结果 | |
60 | + String result = captcha.text(); | |
61 | + String uuid = imgCaptchaUtils.setImgCaptcha4uuid(result); | |
62 | + // 验证码信息 | |
63 | + Map<String, Object> imgResult = new HashMap<String, Object>(2) {{ | |
64 | + put("img", captcha.toBase64()); | |
65 | + put("uuid", uuid); | |
66 | + }}; | |
67 | + return ServerResult.success(imgResult); | |
68 | + } | |
69 | +} | |
70 | + | ... | ... |
src/main/java/com/order/erp/controller/TestController.java deleted
100644 → 0
1 | -package com.order.erp.controller; | |
2 | - | |
3 | -import com.canrd.shop.common.annotation.AnonymousAccess; | |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.vo.TestQueryVO; | |
6 | -import com.canrd.shop.domain.vo.TestVO; | |
7 | -import com.canrd.shop.service.TestService; | |
8 | -import lombok.extern.slf4j.Slf4j; | |
9 | -import org.springframework.web.bind.annotation.PostMapping; | |
10 | -import org.springframework.web.bind.annotation.RequestBody; | |
11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
12 | -import org.springframework.web.bind.annotation.RestController; | |
13 | - | |
14 | -import javax.annotation.Resource; | |
15 | - | |
16 | -/** | |
17 | - * @projectName: canrd-services | |
18 | - * @package: com.canrd.shop.controller | |
19 | - * @className: TestController | |
20 | - * @author: xms | |
21 | - * @description: TODO | |
22 | - * @date: 2023/3/29 18:53 | |
23 | - * @version: 1.0 | |
24 | - */ | |
25 | - | |
26 | -@RestController | |
27 | -@RequestMapping("/admin/shop/test") | |
28 | -@Slf4j | |
29 | -public class TestController { | |
30 | - | |
31 | - @Resource | |
32 | - private TestService testService; | |
33 | - | |
34 | - /** | |
35 | - * @param queryVO | |
36 | - * @return | |
37 | - */ | |
38 | - @AnonymousAccess | |
39 | - @PostMapping("/demo") | |
40 | - public ServerResult demo(@RequestBody TestQueryVO queryVO) { | |
41 | - log.info("查询用户列表:{}", queryVO); | |
42 | - return ServerResult.success(testService.pageList(queryVO)); | |
43 | - } | |
44 | - | |
45 | - | |
46 | - /** | |
47 | - * @param testVO | |
48 | - * @return | |
49 | - */ | |
50 | - @PostMapping("/add") | |
51 | - public ServerResult add(@RequestBody TestVO testVO) { | |
52 | - log.info("新增用户列表:{}", testVO); | |
53 | - testService.add(testVO); | |
54 | - return ServerResult.success(); | |
55 | - } | |
56 | -} |
src/main/java/com/order/erp/domain/dto/CompanyDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import java.io.Serializable; | |
11 | - | |
12 | -/** | |
13 | - * @author: xms | |
14 | - * @description: 公司 | |
15 | - * @date: 2023/3/30 15:36 | |
16 | - * @version: 1.0 | |
17 | - */ | |
18 | - | |
19 | -@Data | |
20 | -@EqualsAndHashCode(callSuper = true) | |
21 | -@SuperBuilder(toBuilder = true) | |
22 | -@AllArgsConstructor | |
23 | -@NoArgsConstructor | |
24 | -@TableName("company") | |
25 | -public class CompanyDO extends BaseDO implements Serializable { | |
26 | - | |
27 | - private Long id; | |
28 | - | |
29 | - /** | |
30 | - * 公司编码 | |
31 | - */ | |
32 | - private String code; | |
33 | - | |
34 | - /** | |
35 | - * 公司名称 | |
36 | - */ | |
37 | - private String name; | |
38 | -} |
src/main/java/com/order/erp/domain/dto/DeptDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableField; | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import com.fasterxml.jackson.annotation.JsonIgnore; | |
6 | -import lombok.AllArgsConstructor; | |
7 | -import lombok.Data; | |
8 | -import lombok.EqualsAndHashCode; | |
9 | -import lombok.NoArgsConstructor; | |
10 | -import lombok.experimental.SuperBuilder; | |
11 | - | |
12 | -import javax.validation.constraints.NotBlank; | |
13 | -import javax.validation.constraints.NotNull; | |
14 | -import java.io.Serializable; | |
15 | -import java.util.Set; | |
16 | - | |
17 | -/** | |
18 | - * @author: xms | |
19 | - * @description: 部门 | |
20 | - * @date: 2023/3/30 15:41 | |
21 | - * @version: 1.0 | |
22 | - */ | |
23 | - | |
24 | -@Data | |
25 | -@EqualsAndHashCode(callSuper = true) | |
26 | -@SuperBuilder(toBuilder = true) | |
27 | -@AllArgsConstructor | |
28 | -@NoArgsConstructor | |
29 | -@TableName("dept") | |
30 | -public class DeptDO extends BaseDO implements Serializable { | |
31 | - | |
32 | - /** | |
33 | - * 自增id | |
34 | - */ | |
35 | - private Long id; | |
36 | - | |
37 | - @NotBlank | |
38 | - private String name; | |
39 | - | |
40 | - @NotNull | |
41 | - private Long pid; | |
42 | - | |
43 | - @JsonIgnore | |
44 | - @TableField(exist = false) | |
45 | - private Set<RoleDO> roles; | |
46 | -} |
src/main/java/com/order/erp/domain/dto/DictDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import javax.validation.constraints.NotBlank; | |
11 | -import java.io.Serializable; | |
12 | - | |
13 | -/** | |
14 | - * @author: xms | |
15 | - * @description: 字典 | |
16 | - * @date: 2023/3/30 16:44 | |
17 | - * @version: 1.0 | |
18 | - */ | |
19 | - | |
20 | -@Data | |
21 | -@EqualsAndHashCode(callSuper = true) | |
22 | -@SuperBuilder(toBuilder = true) | |
23 | -@AllArgsConstructor | |
24 | -@NoArgsConstructor | |
25 | -@TableName("dict") | |
26 | -public class DictDO extends BaseDO implements Serializable { | |
27 | - | |
28 | - private Long id; | |
29 | - | |
30 | - @NotBlank | |
31 | - private String name; | |
32 | - | |
33 | - private String remark; | |
34 | -} |
src/main/java/com/order/erp/domain/dto/DictDetailDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import java.io.Serializable; | |
11 | - | |
12 | -/** | |
13 | - * @author: xms | |
14 | - * @description: 字典 | |
15 | - * @date: 2023/3/30 16:44 | |
16 | - * @version: 1.0 | |
17 | - */ | |
18 | - | |
19 | -@Data | |
20 | -@EqualsAndHashCode(callSuper = true) | |
21 | -@SuperBuilder(toBuilder = true) | |
22 | -@AllArgsConstructor | |
23 | -@NoArgsConstructor | |
24 | -@TableName("dict_detail") | |
25 | -public class DictDetailDO extends BaseDO implements Serializable { | |
26 | - | |
27 | - private Long id; | |
28 | - | |
29 | - /** | |
30 | - * 字典标签 | |
31 | - */ | |
32 | - private String label; | |
33 | - | |
34 | - /** | |
35 | - * 字典值 | |
36 | - */ | |
37 | - private String value; | |
38 | - | |
39 | - /** | |
40 | - * 排序 | |
41 | - */ | |
42 | - private String sort = "999"; | |
43 | - | |
44 | - /** | |
45 | - * 字典id | |
46 | - */ | |
47 | - private Long dictId; | |
48 | -} |
src/main/java/com/order/erp/domain/dto/JobDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import javax.validation.constraints.NotBlank; | |
11 | -import javax.validation.constraints.NotNull; | |
12 | -import java.io.Serializable; | |
13 | - | |
14 | -/** | |
15 | - * @author: xms | |
16 | - * @description: 岗位 | |
17 | - * @date: 2023/3/30 15:57 | |
18 | - * @version: 1.0 | |
19 | - */ | |
20 | - | |
21 | -@Data | |
22 | -@EqualsAndHashCode(callSuper = true) | |
23 | -@SuperBuilder(toBuilder = true) | |
24 | -@AllArgsConstructor | |
25 | -@NoArgsConstructor | |
26 | -@TableName("job") | |
27 | -public class JobDO extends BaseDO implements Serializable { | |
28 | - | |
29 | - /** | |
30 | - * 自增id | |
31 | - */ | |
32 | - private Long id; | |
33 | - | |
34 | - /** | |
35 | - * 岗位名称 | |
36 | - */ | |
37 | - @NotBlank | |
38 | - private String name; | |
39 | - | |
40 | - /** | |
41 | - * 排序 | |
42 | - */ | |
43 | - @NotNull | |
44 | - private Long sort; | |
45 | - | |
46 | - /** | |
47 | - * 部门id | |
48 | - */ | |
49 | - private Long deptId; | |
50 | - | |
51 | -} |
src/main/java/com/order/erp/domain/dto/MenuDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableField; | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import com.fasterxml.jackson.annotation.JsonIgnore; | |
6 | -import lombok.AllArgsConstructor; | |
7 | -import lombok.Data; | |
8 | -import lombok.EqualsAndHashCode; | |
9 | -import lombok.NoArgsConstructor; | |
10 | -import lombok.experimental.SuperBuilder; | |
11 | - | |
12 | -import javax.validation.constraints.NotBlank; | |
13 | -import java.io.Serializable; | |
14 | -import java.util.Set; | |
15 | - | |
16 | -/** | |
17 | - * @author: xms | |
18 | - * @description: 菜单 | |
19 | - * @date: 2023/3/30 16:29 | |
20 | - * @version: 1.0 | |
21 | - */ | |
22 | - | |
23 | -@Data | |
24 | -@EqualsAndHashCode(callSuper = true) | |
25 | -@SuperBuilder(toBuilder = true) | |
26 | -@AllArgsConstructor | |
27 | -@NoArgsConstructor | |
28 | -@TableName("menu") | |
29 | -public class MenuDO extends BaseDO implements Serializable { | |
30 | - | |
31 | - /** | |
32 | - * id | |
33 | - */ | |
34 | - private Long id; | |
35 | - | |
36 | - @NotBlank | |
37 | - private String name; | |
38 | - | |
39 | - /** | |
40 | - * 排序 | |
41 | - */ | |
42 | - private Long sort = 999L; | |
43 | - | |
44 | - /** | |
45 | - * 菜单路径 | |
46 | - */ | |
47 | - private String path; | |
48 | - | |
49 | - /** | |
50 | - * | |
51 | - */ | |
52 | - private String component; | |
53 | - | |
54 | - /** | |
55 | - * 类型,目录、菜单、按钮 | |
56 | - */ | |
57 | - private Integer type; | |
58 | - | |
59 | - /** | |
60 | - * 权限 | |
61 | - */ | |
62 | - private String permission; | |
63 | - | |
64 | - /** | |
65 | - * | |
66 | - */ | |
67 | - private String componentName; | |
68 | - | |
69 | - /** | |
70 | - * | |
71 | - */ | |
72 | - private String icon; | |
73 | - | |
74 | - | |
75 | - private Boolean cache; | |
76 | - | |
77 | - | |
78 | - private Boolean hidden; | |
79 | - | |
80 | - /** | |
81 | - * 上级菜单ID | |
82 | - */ | |
83 | - private Long pid; | |
84 | - | |
85 | - /** | |
86 | - * 是否为外链 true/false | |
87 | - */ | |
88 | - private Boolean iFrame; | |
89 | - | |
90 | - @JsonIgnore | |
91 | - @TableField(exist = false) | |
92 | - private Set<RoleDO> roles; | |
93 | -} |
src/main/java/com/order/erp/domain/dto/RoleDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableField; | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import com.fasterxml.jackson.annotation.JsonIgnore; | |
6 | -import lombok.AllArgsConstructor; | |
7 | -import lombok.Data; | |
8 | -import lombok.EqualsAndHashCode; | |
9 | -import lombok.NoArgsConstructor; | |
10 | -import lombok.experimental.SuperBuilder; | |
11 | - | |
12 | -import javax.validation.constraints.NotBlank; | |
13 | -import java.io.Serializable; | |
14 | -import java.util.Set; | |
15 | - | |
16 | -/** | |
17 | - * @projectName: canrd-services | |
18 | - * @package: com.canrd.shop.domain.com.canrd.shop.template.dto | |
19 | - * @className: RoleDO | |
20 | - * @author: xms | |
21 | - * @description: 角色 | |
22 | - * @date: 2023/3/30 15:46 | |
23 | - * @version: 1.0 | |
24 | - */ | |
25 | - | |
26 | -@Data | |
27 | -@EqualsAndHashCode(callSuper = true) | |
28 | -@SuperBuilder(toBuilder = true) | |
29 | -@AllArgsConstructor | |
30 | -@NoArgsConstructor | |
31 | -@TableName("role") | |
32 | -public class RoleDO extends BaseDO implements Serializable { | |
33 | - | |
34 | - /** | |
35 | - * 自增id | |
36 | - */ | |
37 | - private Long id; | |
38 | - | |
39 | - @NotBlank | |
40 | - private String name; | |
41 | - | |
42 | - /** | |
43 | - * 数据权限类型 全部 、 本级 、 自定义 | |
44 | - */ | |
45 | - private String dataScope = "本级"; | |
46 | - | |
47 | - /** | |
48 | - * 数值越小,级别越大 | |
49 | - */ | |
50 | - private Integer level = 3; | |
51 | - | |
52 | - private String remark; | |
53 | - | |
54 | - /** | |
55 | - * 权限 | |
56 | - */ | |
57 | - private String permission; | |
58 | - | |
59 | - @JsonIgnore | |
60 | - @TableField(exist = false) | |
61 | - private Set<UserDO> users; | |
62 | - | |
63 | - @JsonIgnore | |
64 | - @TableField(exist = false) | |
65 | - private Set<MenuDO> menus; | |
66 | - | |
67 | - @JsonIgnore | |
68 | - @TableField(exist = false) | |
69 | - private Set<DeptDO> depts; | |
70 | - | |
71 | -} |
src/main/java/com/order/erp/domain/dto/RolesDeptsDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | - | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import lombok.*; | |
6 | -import lombok.experimental.SuperBuilder; | |
7 | - | |
8 | -import java.io.Serializable; | |
9 | - | |
10 | -/** | |
11 | - * (RolesDepts)实体类 | |
12 | - * | |
13 | - * @author xms | |
14 | - * @since 2023-03-30 18:36:30 | |
15 | - */ | |
16 | -@TableName("roles_depts") | |
17 | -@Data | |
18 | -@AllArgsConstructor | |
19 | -@ToString | |
20 | -@NoArgsConstructor | |
21 | -@EqualsAndHashCode(callSuper = false) | |
22 | -@SuperBuilder | |
23 | -public class RolesDeptsDO extends BaseDO implements Serializable { | |
24 | - private static final long serialVersionUID = -65106150541644917L; | |
25 | - | |
26 | - private Long roleId; | |
27 | - | |
28 | - private Long deptId; | |
29 | - | |
30 | -} |
src/main/java/com/order/erp/domain/dto/RolesMenusDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | - | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import lombok.*; | |
6 | -import lombok.experimental.SuperBuilder; | |
7 | - | |
8 | -import java.io.Serializable; | |
9 | - | |
10 | -/** | |
11 | - * (RolesMenus)实体类 | |
12 | - * | |
13 | - * @author xms | |
14 | - * @since 2023-03-30 18:40:57 | |
15 | - */ | |
16 | -@TableName("roles_menus") | |
17 | -@Data | |
18 | -@AllArgsConstructor | |
19 | -@ToString | |
20 | -@NoArgsConstructor | |
21 | -@EqualsAndHashCode(callSuper = false) | |
22 | -@SuperBuilder | |
23 | -public class RolesMenusDO extends BaseDO implements Serializable { | |
24 | - private static final long serialVersionUID = 709202570835132264L; | |
25 | - | |
26 | - private Long roleId; | |
27 | - | |
28 | - private Long menuId; | |
29 | - | |
30 | -} |
src/main/java/com/order/erp/domain/dto/TestDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import java.io.Serializable; | |
11 | - | |
12 | -/** | |
13 | - * @projectName: overtime-services | |
14 | - * @className: HelloDO | |
15 | - * @author: xms | |
16 | - * @description: TODO | |
17 | - * @date: 2023/1/11 15:51 | |
18 | - * @version: 1.0 | |
19 | - */ | |
20 | -@Data | |
21 | -@EqualsAndHashCode(callSuper = true) | |
22 | -@SuperBuilder(toBuilder = true) | |
23 | -@AllArgsConstructor | |
24 | -@NoArgsConstructor | |
25 | -@TableName("hello") | |
26 | -public class TestDO extends BaseDO implements Serializable { | |
27 | - /** | |
28 | - * 自增主键 | |
29 | - */ | |
30 | - private Long id; | |
31 | - | |
32 | - /** | |
33 | - * 账号 | |
34 | - */ | |
35 | - private String username; | |
36 | - | |
37 | - /** | |
38 | - * 姓名 | |
39 | - */ | |
40 | - private String realName; | |
41 | - | |
42 | - /** | |
43 | - * 联系方式 | |
44 | - */ | |
45 | - private String phone; | |
46 | - | |
47 | - /** | |
48 | - * 邮箱 | |
49 | - */ | |
50 | - private String mail; | |
51 | - | |
52 | - /** | |
53 | - * 密码 | |
54 | - */ | |
55 | - private String password; | |
56 | - | |
57 | - /** | |
58 | - * 所属部门 | |
59 | - */ | |
60 | - private String department; | |
61 | - | |
62 | - /** | |
63 | - * 状态,1启用,2禁用,3锁定 | |
64 | - */ | |
65 | - private Integer state; | |
66 | -} |
src/main/java/com/order/erp/domain/dto/UserDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.annotation.TableName; | |
4 | -import lombok.AllArgsConstructor; | |
5 | -import lombok.Data; | |
6 | -import lombok.EqualsAndHashCode; | |
7 | -import lombok.NoArgsConstructor; | |
8 | -import lombok.experimental.SuperBuilder; | |
9 | - | |
10 | -import javax.validation.constraints.Email; | |
11 | -import javax.validation.constraints.NotBlank; | |
12 | -import java.io.Serializable; | |
13 | -import java.time.LocalDateTime; | |
14 | - | |
15 | -/** | |
16 | - * @projectName: canrd-services | |
17 | - * @package: com.canrd.shop.domain.com.canrd.shop.template.dto | |
18 | - * @className: UserDO | |
19 | - * @author: xms | |
20 | - * @description: TODO | |
21 | - * @date: 2023/3/30 15:50 | |
22 | - * @version: 1.0 | |
23 | - */ | |
24 | - | |
25 | -@Data | |
26 | -@EqualsAndHashCode(callSuper = true) | |
27 | -@SuperBuilder(toBuilder = true) | |
28 | -@AllArgsConstructor | |
29 | -@NoArgsConstructor | |
30 | -@TableName("admin_user") | |
31 | -public class UserDO extends BaseDO implements Serializable { | |
32 | - | |
33 | - /** | |
34 | - * 自动id | |
35 | - */ | |
36 | - private Long id; | |
37 | - | |
38 | - @NotBlank | |
39 | - private String username; | |
40 | - | |
41 | - /** | |
42 | - * 用户昵称 | |
43 | - */ | |
44 | - @NotBlank | |
45 | - private String nickName; | |
46 | - | |
47 | - /** | |
48 | - * 性别 | |
49 | - */ | |
50 | - private String sex; | |
51 | - | |
52 | - /** | |
53 | - * 工作性质 | |
54 | - */ | |
55 | - @NotBlank | |
56 | - private String workerType; | |
57 | - | |
58 | - @NotBlank | |
59 | - private Long userAvatarId; | |
60 | - | |
61 | ||
62 | - private String email; | |
63 | - | |
64 | - @NotBlank | |
65 | - private String phone; | |
66 | - | |
67 | - | |
68 | - private String password; | |
69 | - | |
70 | - private LocalDateTime lastPasswordResetTime; | |
71 | - | |
72 | - /** | |
73 | - * 公司id | |
74 | - */ | |
75 | - private Long companyId; | |
76 | - | |
77 | - /** | |
78 | - * 岗位id | |
79 | - */ | |
80 | - private Long jobId; | |
81 | - | |
82 | - /** | |
83 | - * 部门id | |
84 | - */ | |
85 | - private Long deptId; | |
86 | -} |
src/main/java/com/order/erp/domain/dto/UsersRolesDO.java deleted
100644 → 0
1 | -package com.order.erp.domain.dto; | |
2 | - | |
3 | - | |
4 | -import com.baomidou.mybatisplus.annotation.TableName; | |
5 | -import lombok.*; | |
6 | -import lombok.experimental.SuperBuilder; | |
7 | - | |
8 | -import java.io.Serializable; | |
9 | - | |
10 | -/** | |
11 | - * (UsersRoles)实体类 | |
12 | - * | |
13 | - * @author makejava | |
14 | - * @since 2023-03-30 18:43:10 | |
15 | - */ | |
16 | -@TableName("users_roles") | |
17 | -@Data | |
18 | -@AllArgsConstructor | |
19 | -@ToString | |
20 | -@NoArgsConstructor | |
21 | -@EqualsAndHashCode(callSuper = false) | |
22 | -@SuperBuilder | |
23 | -public class UsersRolesDO extends BaseDO implements Serializable { | |
24 | - private static final long serialVersionUID = 320304139834762987L; | |
25 | - | |
26 | - private Long userId; | |
27 | - | |
28 | - private Long roleId; | |
29 | - | |
30 | -} |
src/main/java/com/order/erp/domain/dto/admin/AdminDeptDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 5 | import lombok.*; |
6 | 6 | import lombok.experimental.SuperBuilder; |
7 | 7 | |
... | ... | @@ -23,13 +23,25 @@ import java.io.Serializable; |
23 | 23 | public class AdminDeptDO extends BaseDO implements Serializable { |
24 | 24 | |
25 | 25 | private Long id; |
26 | + | |
26 | 27 | /** |
27 | 28 | * 岗位名称 |
28 | 29 | */ |
29 | 30 | private String name; |
31 | + | |
30 | 32 | /** |
31 | - * pid | |
33 | + * 上级部门 | |
32 | 34 | */ |
33 | 35 | private Long pid; |
34 | 36 | |
37 | + /** | |
38 | + * 子部门数目 | |
39 | + */ | |
40 | + private Integer subCount; | |
41 | + | |
42 | + /** | |
43 | + * 排序 | |
44 | + */ | |
45 | + private Integer deptSort; | |
46 | + | |
35 | 47 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminJobDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 5 | import lombok.*; |
6 | 6 | import lombok.experimental.SuperBuilder; |
7 | 7 | |
... | ... | @@ -21,15 +21,15 @@ import java.io.Serializable; |
21 | 21 | @EqualsAndHashCode(callSuper = false) |
22 | 22 | @SuperBuilder |
23 | 23 | public class AdminJobDO extends BaseDO implements Serializable { |
24 | - | |
24 | + | |
25 | 25 | private Long id; |
26 | - /** | |
26 | + /** | |
27 | 27 | * 岗位名称 |
28 | 28 | */ |
29 | 29 | private String name; |
30 | - /** | |
30 | + /** | |
31 | 31 | * 排序字段 |
32 | 32 | */ |
33 | 33 | private Integer sort; |
34 | - | |
34 | + | |
35 | 35 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminMenuDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 5 | import lombok.*; |
6 | 6 | import lombok.experimental.SuperBuilder; |
7 | 7 | |
... | ... | @@ -24,44 +24,69 @@ public class AdminMenuDO extends BaseDO implements Serializable { |
24 | 24 | |
25 | 25 | private Long id; |
26 | 26 | /** |
27 | - * 父级id | |
27 | + * 上级菜单ID | |
28 | 28 | */ |
29 | 29 | private Long pid; |
30 | + | |
30 | 31 | /** |
31 | - * 菜单名称 | |
32 | + * 子菜单数目 | |
32 | 33 | */ |
33 | - private String name; | |
34 | + private Integer subCount; | |
35 | + | |
34 | 36 | /** |
35 | - * 路径 | |
37 | + * 类型,目录、菜单、按钮 | |
36 | 38 | */ |
37 | - private String path; | |
39 | + private Integer type; | |
40 | + | |
41 | + /** | |
42 | + * 菜单标题 | |
43 | + */ | |
44 | + private String title; | |
45 | + | |
46 | + /** | |
47 | + * 菜单名称 | |
48 | + */ | |
49 | + private String name; | |
50 | + | |
38 | 51 | /** |
39 | 52 | * 组件 |
40 | 53 | */ |
41 | 54 | private String component; |
55 | + | |
42 | 56 | /** |
43 | - * 权限 | |
57 | + * 排序 | |
44 | 58 | */ |
45 | - private String permission; | |
59 | + private Integer menuSort; | |
60 | + | |
46 | 61 | /** |
47 | 62 | * 图标 |
48 | 63 | */ |
49 | 64 | private String icon; |
65 | + | |
50 | 66 | /** |
51 | - * 类型,目录、菜单、按钮 | |
67 | + * 路径 | |
52 | 68 | */ |
53 | - private Integer type; | |
69 | + private String path; | |
70 | + | |
71 | + /** | |
72 | + * 是否为外链 0:否,1:是 | |
73 | + */ | |
74 | + private Integer iFrame; | |
75 | + | |
54 | 76 | /** |
55 | 77 | * cache |
56 | 78 | */ |
57 | 79 | private Integer cache; |
80 | + | |
58 | 81 | /** |
59 | - * 是否隐藏 | |
82 | + * 权限 | |
60 | 83 | */ |
61 | - private Integer hidden; | |
84 | + private String permission; | |
85 | + | |
62 | 86 | /** |
63 | - * 是否为外链 0:否,1:是 | |
87 | + * 是否隐藏 | |
64 | 88 | */ |
65 | - private Integer iFrame; | |
89 | + private Integer hidden; | |
90 | + | |
66 | 91 | |
67 | 92 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminRoleDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 5 | import lombok.*; |
6 | 6 | import lombok.experimental.SuperBuilder; |
7 | 7 | |
... | ... | @@ -27,21 +27,21 @@ public class AdminRoleDO extends BaseDO implements Serializable { |
27 | 27 | * 角色名称 |
28 | 28 | */ |
29 | 29 | private String name; |
30 | + | |
30 | 31 | /** |
31 | - * 备注 | |
32 | - */ | |
33 | - private String remark; | |
34 | - /** | |
35 | - * 权限 | |
32 | + * 数值越小,级别越大 | |
36 | 33 | */ |
37 | - private String permission; | |
34 | + private Integer level; | |
35 | + | |
38 | 36 | /** |
39 | 37 | * 数据权限类型 全部 、 本级 、 自定义 |
40 | 38 | */ |
41 | 39 | private String dataScope; |
40 | + | |
42 | 41 | /** |
43 | - * 数值越小,级别越大 | |
42 | + * 描述 | |
44 | 43 | */ |
45 | - private Integer level; | |
44 | + private String description; | |
45 | + | |
46 | 46 | |
47 | 47 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminRoleDeptDO.java
... | ... | @@ -2,7 +2,6 @@ package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | |
4 | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
5 | -import com.canrd.shop.domain.dto.BaseDO; | |
6 | 5 | import lombok.*; |
7 | 6 | import lombok.experimental.SuperBuilder; |
8 | 7 | |
... | ... | @@ -21,7 +20,7 @@ import java.io.Serializable; |
21 | 20 | @NoArgsConstructor |
22 | 21 | @EqualsAndHashCode(callSuper = false) |
23 | 22 | @SuperBuilder |
24 | -public class AdminRoleDeptDO extends BaseDO implements Serializable { | |
23 | +public class AdminRoleDeptDO implements Serializable { | |
25 | 24 | |
26 | 25 | private Long id; |
27 | 26 | /** | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminCompanyDO.java renamed to src/main/java/com/order/erp/domain/dto/admin/AdminRoleMenuDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | + | |
3 | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
5 | 5 | import lombok.*; |
6 | 6 | import lombok.experimental.SuperBuilder; |
7 | 7 | |
8 | 8 | import java.io.Serializable; |
9 | 9 | |
10 | 10 | /** |
11 | - * 公司表(AdminCompany)实体类 | |
11 | + * 角色-菜单表(AdminRoleDept)实体类 | |
12 | 12 | * |
13 | 13 | * @author makejava |
14 | - * @since 2023-08-30 17:51:44 | |
14 | + * @since 2023-08-30 17:51:48 | |
15 | 15 | */ |
16 | -@TableName("admin_company") | |
16 | +@TableName("admin_role_menu") | |
17 | 17 | @Data |
18 | 18 | @AllArgsConstructor |
19 | 19 | @ToString |
20 | 20 | @NoArgsConstructor |
21 | 21 | @EqualsAndHashCode(callSuper = false) |
22 | 22 | @SuperBuilder |
23 | -public class AdminCompanyDO extends BaseDO implements Serializable { | |
23 | +public class AdminRoleMenuDO implements Serializable { | |
24 | 24 | |
25 | 25 | private Long id; |
26 | 26 | /** |
27 | - * 公司编码 | |
27 | + * 菜单id | |
28 | 28 | */ |
29 | - private String code; | |
29 | + private Long menuId; | |
30 | 30 | /** |
31 | - * 公司名称 | |
31 | + * 角色id | |
32 | 32 | */ |
33 | - private String name; | |
33 | + private Long roleId; | |
34 | 34 | |
35 | 35 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminUserDO.java
1 | 1 | package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | +import com.baomidou.mybatisplus.annotation.FieldFill; | |
4 | +import com.baomidou.mybatisplus.annotation.TableField; | |
3 | 5 | import com.baomidou.mybatisplus.annotation.TableName; |
4 | -import com.canrd.shop.domain.dto.BaseDO; | |
6 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 7 | import lombok.*; |
6 | 8 | import lombok.experimental.SuperBuilder; |
9 | +import org.apache.ibatis.type.LocalDateTimeTypeHandler; | |
7 | 10 | |
8 | 11 | import java.io.Serializable; |
12 | +import java.time.LocalDateTime; | |
9 | 13 | |
10 | 14 | /** |
11 | 15 | * 用户表(AdminUser)实体类 |
... | ... | @@ -23,33 +27,61 @@ import java.io.Serializable; |
23 | 27 | public class AdminUserDO extends BaseDO implements Serializable { |
24 | 28 | |
25 | 29 | private Long id; |
30 | + | |
31 | + /** | |
32 | + * 部门id | |
33 | + */ | |
34 | + private Long deptId; | |
35 | + | |
26 | 36 | /** |
27 | 37 | * 用户名称 |
28 | 38 | */ |
29 | 39 | private String userName; |
40 | + | |
30 | 41 | /** |
31 | 42 | * 用户昵称 |
32 | 43 | */ |
33 | 44 | private String nickName; |
45 | + | |
34 | 46 | /** |
35 | 47 | * 性别 |
36 | 48 | */ |
37 | - private String sex; | |
49 | + private String gender; | |
50 | + | |
38 | 51 | /** |
39 | - * 工作性质 | |
52 | + * 手机号码 | |
40 | 53 | */ |
41 | - private String workerType; | |
54 | + private String phone; | |
55 | + | |
42 | 56 | /** |
43 | 57 | * 邮箱 |
44 | 58 | */ |
45 | 59 | private String email; |
60 | + | |
46 | 61 | /** |
47 | - * 手机号 | |
62 | + * 头像地址 | |
48 | 63 | */ |
49 | - private String phone; | |
64 | + private String avatarName; | |
65 | + | |
66 | + /** | |
67 | + * 头像真实路径 | |
68 | + */ | |
69 | + private String avatarPath; | |
70 | + | |
50 | 71 | /** |
51 | 72 | * 密码 |
52 | 73 | */ |
53 | 74 | private String password; |
54 | 75 | |
76 | + /** | |
77 | + * 是否为admin账号 | |
78 | + */ | |
79 | + private Boolean isAdmin; | |
80 | + | |
81 | + /** | |
82 | + * 修改密码的时间 | |
83 | + */ | |
84 | + @TableField(fill = FieldFill.INSERT_UPDATE, typeHandler = LocalDateTimeTypeHandler.class) | |
85 | + private LocalDateTime passResetTime; | |
86 | + | |
55 | 87 | } | ... | ... |
src/main/java/com/order/erp/domain/vo/admin/AdminCompanyVO.java renamed to src/main/java/com/order/erp/domain/dto/admin/AdminUserJobDO.java
1 | -package com.order.erp.domain.vo.admin; | |
1 | +package com.order.erp.domain.dto.admin; | |
2 | 2 | |
3 | + | |
4 | +import com.baomidou.mybatisplus.annotation.TableName; | |
3 | 5 | import lombok.*; |
4 | 6 | import lombok.experimental.SuperBuilder; |
5 | 7 | |
6 | 8 | import java.io.Serializable; |
7 | 9 | |
8 | 10 | /** |
9 | - * 公司表(AdminCompany)实体类 | |
11 | + * 用户-岗位(AdminUserJobDO)实体类 | |
10 | 12 | * |
11 | 13 | * @author makejava |
12 | - * @since 2023-08-30 17:51:45 | |
14 | + * @since 2023-08-30 17:51:48 | |
13 | 15 | */ |
16 | +@TableName("admin_user_job") | |
14 | 17 | @Data |
15 | 18 | @AllArgsConstructor |
16 | 19 | @ToString |
17 | 20 | @NoArgsConstructor |
18 | 21 | @EqualsAndHashCode(callSuper = false) |
19 | 22 | @SuperBuilder |
20 | -public class AdminCompanyVO implements Serializable { | |
21 | - private static final long serialVersionUID = -11641315094136694L; | |
23 | +public class AdminUserJobDO implements Serializable { | |
22 | 24 | |
23 | 25 | private Long id; |
24 | 26 | /** |
25 | - * 公司编码 | |
27 | + * 用户殴打 | |
26 | 28 | */ |
27 | - private String code; | |
29 | + private Long userId; | |
28 | 30 | /** |
29 | - * 公司名称 | |
31 | + * 岗位id | |
30 | 32 | */ |
31 | - private String name; | |
32 | - | |
33 | + private Long jobId; | |
33 | 34 | |
34 | 35 | } | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/AdminUserRoleDO.java
... | ... | @@ -2,7 +2,6 @@ package com.order.erp.domain.dto.admin; |
2 | 2 | |
3 | 3 | |
4 | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
5 | -import com.canrd.shop.domain.dto.BaseDO; | |
6 | 5 | import lombok.*; |
7 | 6 | import lombok.experimental.SuperBuilder; |
8 | 7 | |
... | ... | @@ -21,7 +20,7 @@ import java.io.Serializable; |
21 | 20 | @NoArgsConstructor |
22 | 21 | @EqualsAndHashCode(callSuper = false) |
23 | 22 | @SuperBuilder |
24 | -public class AdminUserRoleDO extends BaseDO implements Serializable { | |
23 | +public class AdminUserRoleDO implements Serializable { | |
25 | 24 | |
26 | 25 | private Long id; |
27 | 26 | /** | ... | ... |
src/main/java/com/order/erp/domain/dto/admin/DictionaryDO.java
src/main/java/com/order/erp/domain/vo/BasePageVO.java
1 | 1 | package com.order.erp.domain.vo; |
2 | 2 | |
3 | -import com.canrd.shop.common.constant.Constant; | |
4 | -import com.canrd.shop.common.jsr303.OperateGroup; | |
5 | 3 | import com.fasterxml.jackson.annotation.JsonInclude; |
4 | +import com.order.erp.common.constant.Constant; | |
5 | +import com.order.erp.common.jsr303.OperateGroup; | |
6 | 6 | import lombok.AllArgsConstructor; |
7 | 7 | import lombok.Data; |
8 | 8 | import lombok.NoArgsConstructor; | ... | ... |
src/main/java/com/order/erp/domain/vo/RolesDeptsVO.java renamed to src/main/java/com/order/erp/domain/vo/CaptchaMessageVO.java
1 | 1 | package com.order.erp.domain.vo; |
2 | 2 | |
3 | - | |
4 | 3 | import lombok.*; |
5 | 4 | import lombok.experimental.SuperBuilder; |
6 | 5 | |
6 | +import javax.validation.constraints.NotBlank; | |
7 | 7 | import java.io.Serializable; |
8 | 8 | |
9 | 9 | /** |
10 | - * (RolesDepts)实体类 | |
10 | + * (Member)验证码 | |
11 | 11 | * |
12 | 12 | * @author xms |
13 | - * @since 2023-03-30 18:36:33 | |
13 | + * @since 2023-08-22 17:02:39 | |
14 | 14 | */ |
15 | 15 | @Data |
16 | 16 | @AllArgsConstructor |
... | ... | @@ -18,12 +18,31 @@ import java.io.Serializable; |
18 | 18 | @NoArgsConstructor |
19 | 19 | @EqualsAndHashCode(callSuper = false) |
20 | 20 | @SuperBuilder |
21 | -public class RolesDeptsVO implements Serializable { | |
22 | - private static final long serialVersionUID = 791414890840757026L; | |
23 | - | |
24 | - private Long roleId; | |
25 | - | |
26 | - private Long deptId; | |
27 | - | |
21 | +public class CaptchaMessageVO extends BasePageVO implements Serializable { | |
22 | + private static final long serialVersionUID = -98570856671998407L; | |
23 | + | |
24 | + /** | |
25 | + * 类型:register | |
26 | + */ | |
27 | + private String type; | |
28 | + | |
29 | + /** | |
30 | + * 手机号码 | |
31 | + */ | |
32 | + @NotBlank(message = "手机号码不能为空!") | |
33 | + private String phone; | |
34 | + | |
35 | + /** | |
36 | + * 图片验证码 | |
37 | + */ | |
38 | + @NotBlank(message = "图片验证码不能为空!") | |
39 | + private String imgCaptchaCode; | |
40 | + | |
41 | + /** | |
42 | + * 图片验证码标识 | |
43 | + */ | |
44 | + @NotBlank(message = "图片验证码标识不能为空!") | |
45 | + private String imgCaptchaUuid; | |
28 | 46 | |
29 | 47 | } |
48 | + | ... | ... |
src/main/java/com/order/erp/domain/vo/CompanySmallVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | - | |
7 | - | |
8 | -@Data | |
9 | -public class CompanySmallVO implements Serializable { | |
10 | - | |
11 | - private Long id; | |
12 | - | |
13 | - private String name; | |
14 | - | |
15 | - private String code; | |
16 | -} | |
17 | 0 | \ No newline at end of file |
src/main/java/com/order/erp/domain/vo/CompanyVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | -import lombok.Data; | |
4 | - | |
5 | -import java.io.Serializable; | |
6 | -import java.sql.Timestamp; | |
7 | - | |
8 | - | |
9 | -@Data | |
10 | -public class CompanyVO implements Serializable { | |
11 | - | |
12 | - private Long id; | |
13 | - | |
14 | - private String code; | |
15 | - | |
16 | - private String name; | |
17 | - | |
18 | - private Boolean enabled; | |
19 | - | |
20 | - private Timestamp createTime; | |
21 | - | |
22 | - public String getLabel() { | |
23 | - return name; | |
24 | - } | |
25 | -} | |
26 | 0 | \ No newline at end of file |
src/main/java/com/order/erp/domain/vo/EmailVO.java
0 → 100644
1 | +package com.order.erp.domain.vo; | |
2 | + | |
3 | +import lombok.*; | |
4 | +import lombok.experimental.SuperBuilder; | |
5 | + | |
6 | +import java.io.Serializable; | |
7 | +import java.util.HashMap; | |
8 | + | |
9 | +/** | |
10 | + * @author xms | |
11 | + * @since 2023-06-03 | |
12 | + */ | |
13 | + | |
14 | +@Data | |
15 | +@AllArgsConstructor | |
16 | +@ToString | |
17 | +@NoArgsConstructor | |
18 | +@EqualsAndHashCode(callSuper = false) | |
19 | +@SuperBuilder | |
20 | +public class EmailVO implements Serializable { | |
21 | + | |
22 | + /** | |
23 | + * 接收方邮件 | |
24 | + */ | |
25 | + private String[] email; | |
26 | + | |
27 | + /** | |
28 | + * 主题 | |
29 | + */ | |
30 | + private String subject; | |
31 | + | |
32 | + /** | |
33 | + * 邮件内容 | |
34 | + */ | |
35 | + private String content; | |
36 | + | |
37 | + /** | |
38 | + * 模板 | |
39 | + */ | |
40 | + private String template; | |
41 | + | |
42 | + /** | |
43 | + * 自定义参数 | |
44 | + */ | |
45 | + private HashMap<String, String> kvMap; | |
46 | +} | ... | ... |
src/main/java/com/order/erp/domain/vo/RolesMenusVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | -import lombok.*; | |
4 | -import lombok.experimental.SuperBuilder; | |
5 | - | |
6 | -import java.io.Serializable; | |
7 | - | |
8 | -/** | |
9 | - * (RolesMenus)实体类 | |
10 | - * | |
11 | - * @author makejava | |
12 | - * @since 2023-03-30 18:40:59 | |
13 | - */ | |
14 | -@Data | |
15 | -@AllArgsConstructor | |
16 | -@ToString | |
17 | -@NoArgsConstructor | |
18 | -@EqualsAndHashCode(callSuper = false) | |
19 | -@SuperBuilder | |
20 | -public class RolesMenusVO implements Serializable { | |
21 | - private static final long serialVersionUID = -56152641918380485L; | |
22 | - | |
23 | - private Long roleId; | |
24 | - | |
25 | - private Long menuId; | |
26 | - | |
27 | - | |
28 | -} |
src/main/java/com/order/erp/domain/vo/TestVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | - | |
4 | -import com.canrd.shop.common.constant.Constant; | |
5 | -import com.canrd.shop.common.jsr303.OperateGroup; | |
6 | -import lombok.Data; | |
7 | -import org.hibernate.validator.constraints.Length; | |
8 | - | |
9 | -import javax.validation.constraints.NotNull; | |
10 | -import javax.validation.constraints.Pattern; | |
11 | -import java.io.Serializable; | |
12 | - | |
13 | -/** | |
14 | - * @projectName: overtime-services | |
15 | - * @className: HelloQueryVO | |
16 | - * @author: xms | |
17 | - * @description: TODO | |
18 | - * @date: 2023/1/11 16:01 | |
19 | - * @version: 1.0 | |
20 | - */ | |
21 | -@Data | |
22 | -public class TestVO implements Serializable { | |
23 | - /** | |
24 | - * 自增主键 | |
25 | - */ | |
26 | - @NotNull(message = "ID不能为空", groups = {OperateGroup.Update.class}) | |
27 | - private Long id; | |
28 | - | |
29 | - /** | |
30 | - * 账号 | |
31 | - */ | |
32 | - @NotNull(message = "账号不能为空", groups = {OperateGroup.Save.class}) | |
33 | - @Length(min = 1, max = 15, message = "请填写1~15位英文+数字的有效账号", groups = {OperateGroup.Save.class}) | |
34 | - @Pattern(regexp = Constant.EN_NUM_REGEXP, message = "请填写英文+数字的有效账号", groups = {OperateGroup.Save.class}) | |
35 | - private String userName; | |
36 | - | |
37 | - /** | |
38 | - * 姓名 | |
39 | - */ | |
40 | - @NotNull(message = "姓名不能为空", groups = {OperateGroup.Save.class, OperateGroup.Update.class}) | |
41 | - @Length(max = 30, message = "名字过长", groups = {OperateGroup.Save.class, OperateGroup.Update.class}) | |
42 | - private String realName; | |
43 | - | |
44 | - /** | |
45 | - * 联系方式 | |
46 | - */ | |
47 | - private String phone; | |
48 | - | |
49 | - /** | |
50 | - * 邮箱 | |
51 | - */ | |
52 | - private String mail; | |
53 | - | |
54 | - /** | |
55 | - * 所属部门 | |
56 | - */ | |
57 | - private String department; | |
58 | - | |
59 | - /** | |
60 | - * 状态,1启用,2禁用 | |
61 | - */ | |
62 | - private String state; | |
63 | - /** | |
64 | - * 创建时间 | |
65 | - */ | |
66 | - private String createTime; | |
67 | - | |
68 | - /** | |
69 | - * 创建人 | |
70 | - */ | |
71 | - private String createBy; | |
72 | - /** | |
73 | - * 修改时间 | |
74 | - */ | |
75 | - private String modifyTime; | |
76 | - | |
77 | - /** | |
78 | - * 修改人 | |
79 | - */ | |
80 | - private String modifyBy; | |
81 | - | |
82 | - private String roles; | |
83 | - | |
84 | - private String dataPermission; | |
85 | -} |
src/main/java/com/order/erp/domain/vo/UserVO.java
1 | 1 | package com.order.erp.domain.vo; |
2 | 2 | |
3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; |
4 | +import com.order.erp.domain.vo.admin.DeptSmallVO; | |
5 | +import com.order.erp.domain.vo.admin.JobSmallVO; | |
6 | +import com.order.erp.domain.vo.admin.RoleSmallVO; | |
4 | 7 | import io.swagger.annotations.ApiModelProperty; |
5 | 8 | import lombok.Data; |
6 | 9 | |
... | ... | @@ -43,7 +46,6 @@ public class UserVO implements Serializable { |
43 | 46 | @ApiModelProperty(hidden = true) |
44 | 47 | private Set<RoleSmallVO> roles; |
45 | 48 | |
46 | - private CompanySmallVO company; | |
47 | 49 | |
48 | 50 | @ApiModelProperty(hidden = true) |
49 | 51 | private JobSmallVO job; | ... | ... |
src/main/java/com/order/erp/domain/vo/UsersRolesVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | - | |
4 | -import lombok.*; | |
5 | -import lombok.experimental.SuperBuilder; | |
6 | - | |
7 | -import java.io.Serializable; | |
8 | - | |
9 | -/** | |
10 | - * (UsersRoles)实体类 | |
11 | - * | |
12 | - * @author makejava | |
13 | - * @since 2023-03-30 18:43:10 | |
14 | - */ | |
15 | -@Data | |
16 | -@AllArgsConstructor | |
17 | -@ToString | |
18 | -@NoArgsConstructor | |
19 | -@EqualsAndHashCode(callSuper = false) | |
20 | -@SuperBuilder | |
21 | -public class UsersRolesVO implements Serializable { | |
22 | - private static final long serialVersionUID = -41891129366026088L; | |
23 | - | |
24 | - private Long userId; | |
25 | - | |
26 | - private Long roleId; | |
27 | - | |
28 | - | |
29 | -} |
src/main/java/com/order/erp/domain/vo/VisitsVO.java deleted
100644 → 0
1 | -package com.order.erp.domain.vo; | |
2 | - | |
3 | -import lombok.*; | |
4 | -import lombok.experimental.SuperBuilder; | |
5 | - | |
6 | -import java.io.Serializable; | |
7 | - | |
8 | -/** | |
9 | - * (Visits)实体类 | |
10 | - * | |
11 | - * @author makejava | |
12 | - * @since 2023-03-30 18:42:35 | |
13 | - */ | |
14 | -@Data | |
15 | -@AllArgsConstructor | |
16 | -@ToString | |
17 | -@NoArgsConstructor | |
18 | -@EqualsAndHashCode(callSuper = false) | |
19 | -@SuperBuilder | |
20 | -public class VisitsVO implements Serializable { | |
21 | - private static final long serialVersionUID = -90062665287384516L; | |
22 | - | |
23 | - private Long id; | |
24 | - | |
25 | - private String date; | |
26 | - | |
27 | - private Long ipCounts; | |
28 | - | |
29 | - private Long pvCounts; | |
30 | - | |
31 | - private String weekDay; | |
32 | - | |
33 | - | |
34 | -} |
src/main/java/com/order/erp/domain/vo/admin/AdminCompanyQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminDeptQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminJobQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminMenuQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminRoleDeptQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminRoleQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminUserQueryVO.java
src/main/java/com/order/erp/domain/vo/admin/AdminUserRoleQueryVO.java
src/main/java/com/order/erp/domain/vo/DeptSmallVO.java renamed to src/main/java/com/order/erp/domain/vo/admin/DeptSmallVO.java
src/main/java/com/order/erp/domain/vo/admin/DictionaryQueryVO.java
src/main/java/com/order/erp/domain/vo/JobSmallVO.java renamed to src/main/java/com/order/erp/domain/vo/admin/JobSmallVO.java
src/main/java/com/order/erp/domain/vo/RoleSmallVO.java renamed to src/main/java/com/order/erp/domain/vo/admin/RoleSmallVO.java
src/main/java/com/order/erp/mapper/CompanyMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.CompanyDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 公司 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface CompanyMapper extends BaseMapper<CompanyDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/DeptMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.DeptDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 部门 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface DeptMapper extends BaseMapper<DeptDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/DictDetailMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.DictDetailDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 字典明细 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface DictDetailMapper extends BaseMapper<DictDetailDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/DictMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.DictDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 字典 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface DictMapper extends BaseMapper<DictDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/JobMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.JobDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 岗位 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface JobMapper extends BaseMapper<JobDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/MenuMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.MenuDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 菜单 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface MenuMapper extends BaseMapper<MenuDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/RoleMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.RoleDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 角色 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface RoleMapper extends BaseMapper<RoleDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/RolesDeptsMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.RolesDeptsDO; | |
5 | - | |
6 | -/** | |
7 | - * (RolesDepts)表数据库访问层 | |
8 | - * | |
9 | - * @author makejava | |
10 | - * @since 2023-03-30 18:36:34 | |
11 | - */ | |
12 | -public interface RolesDeptsMapper extends BaseMapper<RolesDeptsDO> { | |
13 | - | |
14 | - | |
15 | -} | |
16 | - |
src/main/java/com/order/erp/mapper/RolesMenusMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.RolesMenusDO; | |
5 | - | |
6 | -/** | |
7 | - * (RolesMenus)表数据库访问层 | |
8 | - * | |
9 | - * @author makejava | |
10 | - * @since 2023-03-30 18:40:59 | |
11 | - */ | |
12 | -public interface RolesMenusMapper extends BaseMapper<RolesMenusDO> { | |
13 | - | |
14 | - | |
15 | -} | |
16 | - |
src/main/java/com/order/erp/mapper/TestMapper.java
1 | 1 | package com.order.erp.mapper; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | -import com.canrd.shop.domain.dto.TestDO; | |
4 | +import com.order.erp.domain.dto.BaseDO; | |
5 | 5 | import org.apache.ibatis.annotations.Mapper; |
6 | 6 | |
7 | 7 | /** |
... | ... | @@ -11,5 +11,5 @@ import org.apache.ibatis.annotations.Mapper; |
11 | 11 | * @version: 1.0 |
12 | 12 | */ |
13 | 13 | @Mapper |
14 | -public interface TestMapper extends BaseMapper<TestDO> { | |
14 | +public interface TestMapper extends BaseMapper<BaseDO> { | |
15 | 15 | } | ... | ... |
src/main/java/com/order/erp/mapper/UserAvatarMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import org.apache.ibatis.annotations.Mapper; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 用户头像 | |
9 | - * @date: 2023/1/11 15:53 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -@Mapper | |
13 | -public interface UserAvatarMapper extends BaseMapper<UserAvatarDO> { | |
14 | -} |
src/main/java/com/order/erp/mapper/UserMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.UserDO; | |
5 | -import org.apache.ibatis.annotations.Mapper; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 用户 | |
10 | - * @date: 2023/1/11 15:53 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -@Mapper | |
14 | -public interface UserMapper extends BaseMapper<UserDO> { | |
15 | -} |
src/main/java/com/order/erp/mapper/UsersRolesMapper.java deleted
100644 → 0
1 | -package com.order.erp.mapper; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
4 | -import com.canrd.shop.domain.dto.UsersRolesDO; | |
5 | - | |
6 | -/** | |
7 | - * (UsersRoles)表数据库访问层 | |
8 | - * | |
9 | - * @author makejava | |
10 | - * @since 2023-03-30 18:43:10 | |
11 | - */ | |
12 | -public interface UsersRolesMapper extends BaseMapper<UsersRolesDO> { | |
13 | - | |
14 | - | |
15 | -} | |
16 | - |
src/main/java/com/order/erp/mapper/admin/AdminDeptMapper.java
src/main/java/com/order/erp/mapper/admin/AdminJobMapper.java
src/main/java/com/order/erp/mapper/admin/AdminMenuMapper.java
src/main/java/com/order/erp/mapper/admin/AdminRoleDeptMapper.java
src/main/java/com/order/erp/mapper/admin/AdminRoleMapper.java
src/main/java/com/order/erp/mapper/admin/AdminCompanyMapper.java renamed to src/main/java/com/order/erp/mapper/admin/AdminRoleMenuMapper.java
1 | 1 | package com.order.erp.mapper.admin; |
2 | 2 | |
3 | - | |
4 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
5 | -import com.canrd.shop.domain.dto.admin.AdminCompanyDO; | |
4 | +import com.order.erp.domain.dto.admin.AdminRoleMenuDO; | |
6 | 5 | |
7 | 6 | /** |
8 | - * 公司表(AdminCompany)表数据库访问层 | |
7 | + * 角色-部门表(AdminRoleDept)表数据库访问层 | |
9 | 8 | * |
10 | 9 | * @author makejava |
11 | - * @since 2023-08-30 17:51:46 | |
10 | + * @since 2023-08-30 17:51:48 | |
12 | 11 | */ |
13 | -public interface AdminCompanyMapper extends BaseMapper<AdminCompanyDO> { | |
12 | +public interface AdminRoleMenuMapper extends BaseMapper<AdminRoleMenuDO> { | |
14 | 13 | |
15 | 14 | |
16 | 15 | } | ... | ... |
src/main/java/com/order/erp/mapper/VisitsMapper.java renamed to src/main/java/com/order/erp/mapper/admin/AdminUserJobMapper.java
1 | -package com.order.erp.mapper; | |
1 | +package com.order.erp.mapper.admin; | |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
4 | +import com.order.erp.domain.dto.admin.AdminUserJobDO; | |
4 | 5 | |
5 | 6 | /** |
6 | - * (Visits)表数据库访问层 | |
7 | + * 用户-岗位表(AdminUser)表数据库访问层 | |
7 | 8 | * |
8 | 9 | * @author makejava |
9 | - * @since 2023-03-30 18:42:35 | |
10 | + * @since 2023-08-30 17:51:48 | |
10 | 11 | */ |
11 | -public interface VisitsMapper extends BaseMapper<VisitsDO> { | |
12 | +public interface AdminUserJobMapper extends BaseMapper<AdminUserJobDO> { | |
12 | 13 | |
13 | 14 | |
14 | 15 | } | ... | ... |
src/main/java/com/order/erp/mapper/admin/AdminUserMapper.java
src/main/java/com/order/erp/mapper/admin/AdminUserRoleMapper.java
src/main/java/com/order/erp/mapper/admin/DictionaryMapper.java
src/main/java/com/order/erp/security/TokenFilter.java
1 | 1 | package com.order.erp.security; |
2 | 2 | |
3 | -import com.canrd.shop.common.utils.SpringContextHolder; | |
4 | -import com.canrd.shop.security.config.SecurityProperties; | |
5 | -import com.canrd.shop.security.service.OnlineUserService; | |
6 | -import com.canrd.shop.security.vo.OnlineUser; | |
3 | +import com.order.erp.common.utils.SpringContextHolder; | |
4 | +import com.order.erp.security.config.SecurityProperties; | |
5 | +import com.order.erp.security.service.OnlineUserService; | |
6 | +import com.order.erp.security.vo.OnlineUser; | |
7 | 7 | import io.jsonwebtoken.ExpiredJwtException; |
8 | 8 | import lombok.extern.slf4j.Slf4j; |
9 | 9 | import org.springframework.security.core.Authentication; | ... | ... |
src/main/java/com/order/erp/security/TokenProvider.java
src/main/java/com/order/erp/security/config/SecurityConfig.java
1 | 1 | package com.order.erp.security.config; |
2 | 2 | |
3 | -import com.canrd.shop.common.annotation.AnonymousAccess; | |
4 | -import com.canrd.shop.security.JwtAccessDeniedHandler; | |
5 | -import com.canrd.shop.security.JwtAuthenticationEntryPoint; | |
6 | -import com.canrd.shop.security.TokenConfigurer; | |
7 | -import com.canrd.shop.security.TokenProvider; | |
3 | +import com.order.erp.common.annotation.AnonymousAccess; | |
4 | +import com.order.erp.security.JwtAccessDeniedHandler; | |
5 | +import com.order.erp.security.JwtAuthenticationEntryPoint; | |
6 | +import com.order.erp.security.TokenConfigurer; | |
7 | +import com.order.erp.security.TokenProvider; | |
8 | 8 | import org.springframework.context.ApplicationContext; |
9 | 9 | import org.springframework.context.annotation.Bean; |
10 | 10 | import org.springframework.context.annotation.Configuration; |
11 | 11 | import org.springframework.http.HttpMethod; |
12 | +import org.springframework.security.authentication.AuthenticationManager; | |
12 | 13 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
13 | 14 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
14 | 15 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
... | ... | @@ -35,7 +36,7 @@ import java.util.Set; |
35 | 36 | @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) |
36 | 37 | public class SecurityConfig extends WebSecurityConfigurerAdapter { |
37 | 38 | |
38 | - private final TokenProvider tokenProvider; | |
39 | + private TokenProvider tokenProvider; | |
39 | 40 | private final CorsFilter corsFilter; |
40 | 41 | private final JwtAuthenticationEntryPoint authenticationErrorHandler; |
41 | 42 | private final JwtAccessDeniedHandler jwtAccessDeniedHandler; |
... | ... | @@ -128,4 +129,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { |
128 | 129 | private TokenConfigurer securityConfigurerAdapter() { |
129 | 130 | return new TokenConfigurer(tokenProvider); |
130 | 131 | } |
132 | + | |
133 | + @Bean | |
134 | + @Override | |
135 | + public AuthenticationManager authenticationManagerBean() throws Exception { | |
136 | + return super.authenticationManagerBean(); | |
137 | + } | |
131 | 138 | } | ... | ... |
src/main/java/com/order/erp/security/service/OnlineUserService.java
1 | 1 | package com.order.erp.security.service; |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
4 | -import com.canrd.shop.common.utils.EncryptUtils; | |
5 | -import com.canrd.shop.common.utils.PageUtils; | |
6 | -import com.canrd.shop.common.utils.RedisUtils; | |
7 | -import com.canrd.shop.common.utils.RequestStringUtils; | |
8 | -import com.canrd.shop.security.config.SecurityProperties; | |
9 | -import com.canrd.shop.security.vo.JwtUser; | |
10 | -import com.canrd.shop.security.vo.OnlineUser; | |
3 | +import com.alibaba.fastjson.JSON; | |
4 | +import com.order.erp.common.utils.EncryptUtils; | |
5 | +import com.order.erp.common.utils.RedisUtil; | |
6 | +import com.order.erp.common.utils.RequestStringUtils; | |
7 | +import com.order.erp.security.config.SecurityProperties; | |
8 | +import com.order.erp.security.vo.JwtUser; | |
9 | +import com.order.erp.security.vo.OnlineUser; | |
11 | 10 | import lombok.extern.slf4j.Slf4j; |
12 | -import org.springframework.data.domain.Pageable; | |
13 | 11 | import org.springframework.stereotype.Service; |
14 | 12 | |
13 | +import javax.annotation.Resource; | |
15 | 14 | import javax.servlet.http.HttpServletRequest; |
16 | -import java.util.*; | |
15 | +import java.util.Date; | |
17 | 16 | |
18 | 17 | /** |
19 | 18 | * @Date 2019年10月26日21:56:27 |
... | ... | @@ -22,13 +21,12 @@ import java.util.*; |
22 | 21 | @Slf4j |
23 | 22 | public class OnlineUserService { |
24 | 23 | |
25 | - private final SecurityProperties properties; | |
26 | - private RedisUtils redisUtils; | |
24 | + @Resource | |
25 | + private SecurityProperties properties; | |
26 | + | |
27 | + @Resource | |
28 | + private RedisUtil redisUtil; | |
27 | 29 | |
28 | - public OnlineUserService(SecurityProperties properties, RedisUtils redisUtils) { | |
29 | - this.properties = properties; | |
30 | - this.redisUtils = redisUtils; | |
31 | - } | |
32 | 30 | |
33 | 31 | /** |
34 | 32 | * 保存在线用户信息 |
... | ... | @@ -48,48 +46,9 @@ public class OnlineUserService { |
48 | 46 | } catch (Exception e) { |
49 | 47 | e.printStackTrace(); |
50 | 48 | } |
51 | - redisUtils.set(properties.getOnlineKey() + token, onlineUser, properties.getTokenValidityInSeconds() / 1000); | |
49 | + redisUtil.set(properties.getOnlineKey() + token, JSON.toJSONString(onlineUser), properties.getTokenValidityInSeconds() / 1000); | |
52 | 50 | } |
53 | 51 | |
54 | - /** | |
55 | - * 查询全部数据 | |
56 | - * | |
57 | - * @param filter / | |
58 | - * @param pageable / | |
59 | - * @return / | |
60 | - */ | |
61 | - public Map<String, Object> getAll(String filter, Pageable pageable) { | |
62 | - List<OnlineUser> onlineUsers = getAll(filter); | |
63 | - Page<OnlineUser> onlineUserPage = new Page<>(); | |
64 | - onlineUserPage.setTotal(onlineUsers.size()); | |
65 | - onlineUserPage.setSize(onlineUsers.size()); | |
66 | - onlineUserPage.setRecords(onlineUsers); | |
67 | - return PageUtils.getUnifiedPageReturn(onlineUserPage); | |
68 | - } | |
69 | - | |
70 | - /** | |
71 | - * 查询全部数据,不分页 | |
72 | - * | |
73 | - * @param filter / | |
74 | - * @return / | |
75 | - */ | |
76 | - public List<OnlineUser> getAll(String filter) { | |
77 | - List<String> keys = redisUtils.scan(properties.getOnlineKey() + "*"); | |
78 | - Collections.reverse(keys); | |
79 | - List<OnlineUser> onlineUsers = new ArrayList<>(); | |
80 | - for (String key : keys) { | |
81 | - OnlineUser onlineUser = (OnlineUser) redisUtils.get(key); | |
82 | - if (RequestStringUtils.isNotBlank(filter)) { | |
83 | - if (onlineUser.toString().contains(filter)) { | |
84 | - onlineUsers.add(onlineUser); | |
85 | - } | |
86 | - } else { | |
87 | - onlineUsers.add(onlineUser); | |
88 | - } | |
89 | - } | |
90 | - onlineUsers.sort((o1, o2) -> o2.getLoginTime().compareTo(o1.getLoginTime())); | |
91 | - return onlineUsers; | |
92 | - } | |
93 | 52 | |
94 | 53 | /** |
95 | 54 | * 踢出用户 |
... | ... | @@ -99,7 +58,7 @@ public class OnlineUserService { |
99 | 58 | */ |
100 | 59 | public void kickOut(String key) throws Exception { |
101 | 60 | key = properties.getOnlineKey() + EncryptUtils.desDecrypt(key); |
102 | - redisUtils.del(key); | |
61 | + redisUtil.delete(key); | |
103 | 62 | } |
104 | 63 | |
105 | 64 | /** |
... | ... | @@ -109,10 +68,9 @@ public class OnlineUserService { |
109 | 68 | */ |
110 | 69 | public void logout(String token) { |
111 | 70 | String key = properties.getOnlineKey() + token; |
112 | - redisUtils.del(key); | |
71 | + redisUtil.delete(key); | |
113 | 72 | } |
114 | 73 | |
115 | - | |
116 | 74 | /** |
117 | 75 | * 查询用户 |
118 | 76 | * |
... | ... | @@ -120,33 +78,33 @@ public class OnlineUserService { |
120 | 78 | * @return / |
121 | 79 | */ |
122 | 80 | public OnlineUser getOne(String key) { |
123 | - return (OnlineUser) redisUtils.get(key); | |
81 | + return JSON.parseObject(redisUtil.get(key), OnlineUser.class); | |
124 | 82 | } |
125 | 83 | |
126 | - /** | |
127 | - * 检测用户是否在之前已经登录,已经登录踢下线 | |
128 | - * | |
129 | - * @param userName 用户名 | |
130 | - */ | |
131 | - public void checkLoginOnUser(String userName, String igoreToken) { | |
132 | - List<OnlineUser> onlineUsers = getAll(userName); | |
133 | - if (onlineUsers == null || onlineUsers.isEmpty()) { | |
134 | - return; | |
135 | - } | |
136 | - for (OnlineUser onlineUser : onlineUsers) { | |
137 | - if (onlineUser.getUserName().equals(userName)) { | |
138 | - try { | |
139 | - String token = EncryptUtils.desDecrypt(onlineUser.getKey()); | |
140 | - if (RequestStringUtils.isNotBlank(igoreToken) && !igoreToken.equals(token)) { | |
141 | - this.kickOut(onlineUser.getKey()); | |
142 | - } else if (RequestStringUtils.isBlank(igoreToken)) { | |
143 | - this.kickOut(onlineUser.getKey()); | |
144 | - } | |
145 | - } catch (Exception e) { | |
146 | - log.error("checkUser is error", e); | |
147 | - } | |
148 | - } | |
149 | - } | |
150 | - } | |
84 | +// /** | |
85 | +// * 检测用户是否在之前已经登录,已经登录踢下线 | |
86 | +// * | |
87 | +// * @param userName 用户名 | |
88 | +// */ | |
89 | +// public void checkLoginOnUser(String userName, String igoreToken) { | |
90 | +// List<OnlineUser> onlineUsers = getAll(userName); | |
91 | +// if (onlineUsers == null || onlineUsers.isEmpty()) { | |
92 | +// return; | |
93 | +// } | |
94 | +// for (OnlineUser onlineUser : onlineUsers) { | |
95 | +// if (onlineUser.getUserName().equals(userName)) { | |
96 | +// try { | |
97 | +// String token = EncryptUtils.desDecrypt(onlineUser.getKey()); | |
98 | +// if (RequestStringUtils.isNotBlank(igoreToken) && !igoreToken.equals(token)) { | |
99 | +// this.kickOut(onlineUser.getKey()); | |
100 | +// } else if (RequestStringUtils.isBlank(igoreToken)) { | |
101 | +// this.kickOut(onlineUser.getKey()); | |
102 | +// } | |
103 | +// } catch (Exception e) { | |
104 | +// log.error("checkUser is error", e); | |
105 | +// } | |
106 | +// } | |
107 | +// } | |
108 | +// } | |
151 | 109 | |
152 | 110 | } | ... | ... |
src/main/java/com/order/erp/security/service/UserDetailsServiceImpl.java
1 | 1 | package com.order.erp.security.service; |
2 | 2 | |
3 | -import com.canrd.shop.common.exception.BadRequestException; | |
4 | -import com.canrd.shop.domain.vo.*; | |
5 | -import com.canrd.shop.security.vo.JwtUser; | |
6 | -import com.canrd.shop.service.CompanyService; | |
7 | -import com.canrd.shop.service.RoleService; | |
8 | -import com.canrd.shop.service.UserService; | |
3 | +import com.order.erp.common.exception.BusinessException; | |
4 | +import com.order.erp.domain.vo.UserVO; | |
5 | +import com.order.erp.domain.vo.admin.DeptSmallVO; | |
6 | +import com.order.erp.domain.vo.admin.JobSmallVO; | |
7 | +import com.order.erp.security.vo.JwtUser; | |
8 | +import com.order.erp.service.admin.AdminRoleMenuService; | |
9 | +import com.order.erp.service.admin.AdminUserService; | |
9 | 10 | import org.springframework.security.core.userdetails.UserDetails; |
10 | 11 | import org.springframework.security.core.userdetails.UserDetailsService; |
11 | 12 | import org.springframework.stereotype.Service; |
12 | 13 | import org.springframework.transaction.annotation.Propagation; |
13 | 14 | import org.springframework.transaction.annotation.Transactional; |
14 | -import org.springframework.util.ObjectUtils; | |
15 | 15 | |
16 | 16 | import javax.annotation.Resource; |
17 | +import java.util.Objects; | |
17 | 18 | import java.util.Optional; |
18 | 19 | |
19 | 20 | /** |
... | ... | @@ -24,45 +25,22 @@ import java.util.Optional; |
24 | 25 | public class UserDetailsServiceImpl implements UserDetailsService { |
25 | 26 | |
26 | 27 | @Resource |
27 | - private CompanyService companyService; | |
28 | + private AdminUserService userService; | |
28 | 29 | |
29 | 30 | @Resource |
30 | - private UserService userService; | |
31 | - | |
32 | - @Resource | |
33 | - private RoleService roleService; | |
31 | + private AdminRoleMenuService roleService; | |
34 | 32 | |
35 | 33 | |
36 | 34 | @Override |
37 | 35 | public UserDetails loadUserByUsername(String username) { |
38 | - String arr[] = username.split("#"); | |
39 | - if (ObjectUtils.isEmpty(arr) || arr.length <= 1) { | |
40 | - UserVO user = userService.findByName(username); | |
41 | - if (user == null) { | |
42 | - throw new BadRequestException("账号不存在"); | |
43 | - } else { | |
44 | - if (!user.getEnabled()) { | |
45 | - throw new BadRequestException("账号未激活"); | |
46 | - } | |
47 | - return createJwtUser(user); | |
48 | - } | |
49 | - } else { | |
50 | - String name = arr[0]; | |
51 | - String code = arr[1]; | |
52 | - CompanyVO companyVO = companyService.findByCode(code); | |
53 | - if (ObjectUtils.isEmpty(companyVO)) { | |
54 | - throw new BadRequestException("公司不存在!"); | |
55 | - } | |
56 | - UserVO user = userService.findByNameAndCode(name, code); | |
57 | - if (user == null) { | |
58 | - throw new BadRequestException("账号不存在"); | |
59 | - } else { | |
60 | - if (!user.getEnabled()) { | |
61 | - throw new BadRequestException("账号未激活"); | |
62 | - } | |
63 | - return createJwtUser(user); | |
64 | - } | |
36 | + UserVO user = userService.findByUserName(username); | |
37 | + if (Objects.isNull(user)) { | |
38 | + throw new BusinessException("账号不存在"); | |
39 | + } | |
40 | + if (!user.getEnabled()) { | |
41 | + throw new BusinessException("账号未激活"); | |
65 | 42 | } |
43 | + return createJwtUser(user); | |
66 | 44 | } |
67 | 45 | |
68 | 46 | private UserDetails createJwtUser(UserVO user) { |
... | ... | @@ -76,10 +54,10 @@ public class UserDetailsServiceImpl implements UserDetailsService { |
76 | 54 | user.getWorkerType(), |
77 | 55 | user.getEmail(), |
78 | 56 | user.getPhone(), |
79 | - Optional.ofNullable(user.getCompany()).map(CompanySmallVO::getName).orElse(null), | |
80 | 57 | Optional.ofNullable(user.getDept()).map(DeptSmallVO::getName).orElse(null), |
81 | 58 | Optional.ofNullable(user.getJob()).map(JobSmallVO::getName).orElse(null), |
82 | - roleService.mapToGrantedAuthorities(user), | |
59 | +// roleService.mapToGrantedAuthorities(user), | |
60 | + null, | |
83 | 61 | user.getEnabled(), |
84 | 62 | user.getCreateTime(), |
85 | 63 | user.getLastPasswordResetTime() | ... | ... |
src/main/java/com/order/erp/security/vo/JwtUser.java
src/main/java/com/order/erp/service/CompanyService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.CompanyDO; | |
5 | -import com.canrd.shop.domain.vo.CompanyVO; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 公司 | |
10 | - * @date: 2023/1/11 15:54 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -public interface CompanyService extends IService<CompanyDO> { | |
14 | - | |
15 | - /** | |
16 | - * @param code | |
17 | - * @return | |
18 | - */ | |
19 | - CompanyVO findByCode(String code); | |
20 | -} |
src/main/java/com/order/erp/service/DeptService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.DeptDO; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 部门 | |
9 | - * @date: 2023/1/11 15:54 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -public interface DeptService extends IService<DeptDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/DictDetailService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.DictDetailDO; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 字典明细 | |
9 | - * @date: 2023/1/11 15:54 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -public interface DictDetailService extends IService<DictDetailDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/DictService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.DictDO; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 字典 | |
9 | - * @date: 2023/1/11 15:54 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -public interface DictService extends IService<DictDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/JobService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.JobDO; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 岗位 | |
9 | - * @date: 2023/1/11 15:54 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -public interface JobService extends IService<JobDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/MenuService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.MenuDO; | |
5 | - | |
6 | -/** | |
7 | - * @author: xms | |
8 | - * @description: 菜单 | |
9 | - * @date: 2023/1/11 15:54 | |
10 | - * @version: 1.0 | |
11 | - */ | |
12 | -public interface MenuService extends IService<MenuDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/RoleService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.RoleDO; | |
5 | -import com.canrd.shop.domain.vo.UserVO; | |
6 | -import org.springframework.security.core.GrantedAuthority; | |
7 | - | |
8 | -import java.util.Collection; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 角色 | |
13 | - * @date: 2023/1/11 15:54 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -public interface RoleService extends IService<RoleDO> { | |
17 | - | |
18 | - /** | |
19 | - * 获取用户权限信息 | |
20 | - * | |
21 | - * @param user 用户信息 | |
22 | - * @return 权限信息 | |
23 | - */ | |
24 | - Collection<GrantedAuthority> mapToGrantedAuthorities(UserVO user); | |
25 | -} |
src/main/java/com/order/erp/service/RolesMenusService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.RolesMenusDO; | |
5 | - | |
6 | -/** | |
7 | - * (RolesMenus)表服务接口 | |
8 | - * | |
9 | - * @author makejava | |
10 | - * @since 2023-03-30 18:41:00 | |
11 | - */ | |
12 | -public interface RolesMenusService extends IService<RolesMenusDO> { | |
13 | - | |
14 | - | |
15 | -} |
src/main/java/com/order/erp/service/TestService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.TestDO; | |
5 | -import com.canrd.shop.domain.vo.TestQueryVO; | |
6 | -import com.canrd.shop.domain.vo.TestVO; | |
7 | - | |
8 | -import java.util.Map; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: TODO | |
13 | - * @date: 2023/1/11 15:54 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -public interface TestService extends IService<TestDO> { | |
17 | - | |
18 | - Map<String, Object> pageList(TestQueryVO queryVO); | |
19 | - | |
20 | - boolean add(TestVO queryVO); | |
21 | -} |
src/main/java/com/order/erp/service/UserAvatarService.java deleted
100644 → 0
src/main/java/com/order/erp/service/UserService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.UserDO; | |
5 | -import com.canrd.shop.domain.vo.UserVO; | |
6 | - | |
7 | -/** | |
8 | - * @author: xms | |
9 | - * @description: 用户 | |
10 | - * @date: 2023/1/11 15:54 | |
11 | - * @version: 1.0 | |
12 | - */ | |
13 | -public interface UserService extends IService<UserDO> { | |
14 | - | |
15 | - /** | |
16 | - * 根据用户名查询 | |
17 | - * | |
18 | - * @param userName / | |
19 | - * @return / | |
20 | - */ | |
21 | - UserVO findByName(String userName); | |
22 | - | |
23 | - /** | |
24 | - * @param userName | |
25 | - * @param code | |
26 | - * @return | |
27 | - */ | |
28 | - UserVO findByNameAndCode(String userName, String code); | |
29 | - | |
30 | -} |
src/main/java/com/order/erp/service/UsersRolesService.java deleted
100644 → 0
1 | -package com.order.erp.service; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.domain.dto.UsersRolesDO; | |
5 | - | |
6 | -/** | |
7 | - * (UsersRoles)表服务接口 | |
8 | - * | |
9 | - * @author makejava | |
10 | - * @since 2023-03-30 18:43:10 | |
11 | - */ | |
12 | -public interface UsersRolesService extends IService<UsersRolesDO> { | |
13 | - | |
14 | -} |
src/main/java/com/order/erp/service/admin/AdminCompanyService.java deleted
100644 → 0
1 | -package com.order.erp.service.admin; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminCompanyDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminCompanyQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminCompanyVO; | |
8 | - | |
9 | -/** | |
10 | - * 公司表(AdminCompany)表服务接口 | |
11 | - * | |
12 | - * @author makejava | |
13 | - * @since 2023-08-30 17:51:46 | |
14 | - */ | |
15 | -public interface AdminCompanyService extends IService<AdminCompanyDO> { | |
16 | - | |
17 | - /** | |
18 | - * 通过ID查询单条数据 | |
19 | - * | |
20 | - * @param adminCompanyQueryVO 主键 | |
21 | - * @return 实例对象 | |
22 | - */ | |
23 | - ServerResult queryById(AdminCompanyQueryVO adminCompanyQueryVO); | |
24 | - | |
25 | - /** | |
26 | - * 分页查询 | |
27 | - * | |
28 | - * @param adminCompanyQueryVO 筛选条件 | |
29 | - * @return 查询结果 | |
30 | - */ | |
31 | - ServerResult list(AdminCompanyQueryVO adminCompanyQueryVO); | |
32 | - | |
33 | - /** | |
34 | - * 新增数据 | |
35 | - * | |
36 | - * @param adminCompanyVO 数据VO | |
37 | - * @return 新增结果 | |
38 | - */ | |
39 | - ServerResult add(AdminCompanyVO adminCompanyVO); | |
40 | - | |
41 | - /** | |
42 | - * 修改数据 | |
43 | - * | |
44 | - * @param adminCompanyVO 数据VO | |
45 | - * @return 编辑结果 | |
46 | - */ | |
47 | - ServerResult edit(AdminCompanyVO adminCompanyVO); | |
48 | - | |
49 | - /** | |
50 | - * 通过主键删除数据 | |
51 | - * | |
52 | - * @param adminCompanyQueryVO 筛选条件 | |
53 | - * @return 是否成功 | |
54 | - */ | |
55 | - ServerResult deleteById(AdminCompanyQueryVO adminCompanyQueryVO); | |
56 | - | |
57 | -} |
src/main/java/com/order/erp/service/admin/AdminDeptService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminDeptDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminDeptQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminDeptVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminDeptDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminDeptQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminDeptVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 部门表(AdminDept)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/admin/AdminJobService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminJobDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminJobQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminJobVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminJobDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminJobQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminJobVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 岗位表(AdminJob)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/admin/AdminMenuService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminMenuDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminMenuQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminMenuVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminMenuDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminMenuQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminMenuVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 角色表(AdminMenu)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/admin/AdminRoleDeptService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminRoleDeptDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminRoleDeptQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminRoleDeptVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminRoleDeptDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminRoleDeptQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminRoleDeptVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 角色-部门表(AdminRoleDept)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/VisitsService.java renamed to src/main/java/com/order/erp/service/admin/AdminRoleMenuService.java
1 | -package com.order.erp.service; | |
1 | +package com.order.erp.service.admin; | |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | - | |
4 | +import com.order.erp.domain.dto.admin.AdminRoleMenuDO; | |
5 | 5 | |
6 | 6 | /** |
7 | - * (Visits)表服务接口 | |
7 | + * 角色-菜单表(AdminRoleDept)表服务接口 | |
8 | 8 | * |
9 | 9 | * @author makejava |
10 | - * @since 2023-03-30 18:42:35 | |
10 | + * @since 2023-08-30 17:51:48 | |
11 | 11 | */ |
12 | -public interface VisitsService extends IService<VisitsDO> { | |
12 | +public interface AdminRoleMenuService extends IService<AdminRoleMenuDO> { | |
13 | + | |
13 | 14 | |
14 | 15 | } | ... | ... |
src/main/java/com/order/erp/service/admin/AdminRoleService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminRoleDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminRoleQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminRoleVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminRoleDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminRoleQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminRoleVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 角色表(AdminRole)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/RolesDeptsService.java renamed to src/main/java/com/order/erp/service/admin/AdminUserJobService.java
1 | -package com.order.erp.service; | |
1 | +package com.order.erp.service.admin; | |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.domain.dto.RolesDeptsDO; | |
4 | +import com.order.erp.domain.dto.admin.AdminUserJobDO; | |
5 | 5 | |
6 | 6 | /** |
7 | - * (RolesDepts)表服务接口 | |
7 | + * 用户-岗位表(AdminUserJobDO)表服务接口 | |
8 | 8 | * |
9 | 9 | * @author makejava |
10 | - * @since 2023-03-30 18:36:34 | |
10 | + * @since 2023-08-30 17:51:48 | |
11 | 11 | */ |
12 | -public interface RolesDeptsService extends IService<RolesDeptsDO> { | |
12 | +public interface AdminUserJobService extends IService<AdminUserJobDO> { | |
13 | + | |
13 | 14 | |
14 | 15 | } | ... | ... |
src/main/java/com/order/erp/service/admin/AdminUserRoleService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminUserRoleDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminUserRoleQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminUserRoleVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminUserRoleDO; | |
6 | +import com.order.erp.domain.vo.admin.AdminUserRoleQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminUserRoleVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 用户角色表(AdminUserRole)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/admin/AdminUserService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.AdminUserDO; | |
6 | -import com.canrd.shop.domain.vo.admin.AdminUserQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.AdminUserVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.AdminUserDO; | |
6 | +import com.order.erp.domain.vo.UserVO; | |
7 | +import com.order.erp.domain.vo.admin.AdminUserQueryVO; | |
8 | +import com.order.erp.domain.vo.admin.AdminUserVO; | |
8 | 9 | |
9 | 10 | /** |
10 | 11 | * 用户表(AdminUser)表服务接口 |
... | ... | @@ -54,4 +55,12 @@ public interface AdminUserService extends IService<AdminUserDO> { |
54 | 55 | */ |
55 | 56 | ServerResult deleteById(AdminUserQueryVO adminUserQueryVO); |
56 | 57 | |
58 | + /** | |
59 | + * 用户名称/手机号/邮箱号 | |
60 | + * | |
61 | + * @param userName | |
62 | + * @return | |
63 | + */ | |
64 | + UserVO findByUserName(String userName); | |
65 | + | |
57 | 66 | } | ... | ... |
src/main/java/com/order/erp/service/admin/DictionaryService.java
1 | 1 | package com.order.erp.service.admin; |
2 | 2 | |
3 | 3 | import com.baomidou.mybatisplus.extension.service.IService; |
4 | -import com.canrd.shop.common.constant.ServerResult; | |
5 | -import com.canrd.shop.domain.dto.admin.DictionaryDO; | |
6 | -import com.canrd.shop.domain.vo.admin.DictionaryQueryVO; | |
7 | -import com.canrd.shop.domain.vo.admin.DictionaryVO; | |
4 | +import com.order.erp.common.constant.ServerResult; | |
5 | +import com.order.erp.domain.dto.admin.DictionaryDO; | |
6 | +import com.order.erp.domain.vo.admin.DictionaryQueryVO; | |
7 | +import com.order.erp.domain.vo.admin.DictionaryVO; | |
8 | 8 | |
9 | 9 | /** |
10 | 10 | * 字典表(Dictionary)表服务接口 | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminCompanyServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.admin.impl; | |
2 | - | |
3 | -import cn.hutool.core.bean.BeanUtil; | |
4 | -import cn.hutool.core.collection.CollUtil; | |
5 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
6 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
7 | -import com.baomidou.mybatisplus.core.metadata.IPage; | |
8 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
9 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
10 | -import com.canrd.shop.common.constant.Constant; | |
11 | -import com.canrd.shop.common.constant.ServerResult; | |
12 | -import com.canrd.shop.common.utils.PageUtils; | |
13 | -import com.canrd.shop.domain.dto.admin.AdminCompanyDO; | |
14 | -import com.canrd.shop.domain.vo.admin.AdminCompanyQueryVO; | |
15 | -import com.canrd.shop.domain.vo.admin.AdminCompanyVO; | |
16 | -import com.canrd.shop.mapper.admin.AdminCompanyMapper; | |
17 | -import com.canrd.shop.service.admin.AdminCompanyService; | |
18 | -import lombok.extern.slf4j.Slf4j; | |
19 | -import org.springframework.stereotype.Service; | |
20 | - | |
21 | -import java.util.ArrayList; | |
22 | -import java.util.List; | |
23 | -import java.util.Objects; | |
24 | - | |
25 | -/** | |
26 | - * 公司表(AdminCompany)表服务实现类 | |
27 | - * | |
28 | - * @author makejava | |
29 | - * @since 2023-08-30 17:51:47 | |
30 | - */ | |
31 | -@Slf4j | |
32 | -@Service | |
33 | -public class AdminCompanyServiceImpl extends ServiceImpl<AdminCompanyMapper, AdminCompanyDO> implements AdminCompanyService { | |
34 | - | |
35 | - | |
36 | - /** | |
37 | - * 通过ID查询单条数据 | |
38 | - * <p> | |
39 | - * adminCompanyQueryVO 主键 | |
40 | - * | |
41 | - * @return 实例对象 | |
42 | - */ | |
43 | - @Override | |
44 | - public ServerResult queryById(AdminCompanyQueryVO adminCompanyQueryVO) { | |
45 | - if (Objects.isNull(adminCompanyQueryVO.getId())) { | |
46 | - return ServerResult.fail("id 不能为空"); | |
47 | - } | |
48 | - AdminCompanyDO AdminCompanyDo = getById(adminCompanyQueryVO.getId()); | |
49 | - if (Objects.isNull(AdminCompanyDo)) { | |
50 | - return ServerResult.success(null); | |
51 | - } | |
52 | - return ServerResult.success(BeanUtil.copyProperties(AdminCompanyDo, AdminCompanyVO.class)); | |
53 | - } | |
54 | - | |
55 | - /** | |
56 | - * 分页查询 | |
57 | - * | |
58 | - * @param adminCompanyQueryVO 筛选条件 | |
59 | - * @return 查询结果 | |
60 | - */ | |
61 | - @Override | |
62 | - public ServerResult list(AdminCompanyQueryVO adminCompanyQueryVO) { | |
63 | - | |
64 | - LambdaQueryWrapper<AdminCompanyDO> queryWapper = new LambdaQueryWrapper<AdminCompanyDO>() | |
65 | - .eq(AdminCompanyDO::getEnableFlag, Constant.ENABLE_TEN) | |
66 | - .orderByDesc(AdminCompanyDO::getId); | |
67 | - Page page = new Page<>(adminCompanyQueryVO.getPageNo(), adminCompanyQueryVO.getPageSize()); | |
68 | - IPage<AdminCompanyDO> iPage = page(page, queryWapper); | |
69 | - adminCompanyQueryVO.setTotal(Long.valueOf(iPage.getTotal()).intValue()); | |
70 | - List<AdminCompanyVO> result = new ArrayList<>(); | |
71 | - return ServerResult.success(PageUtils.getPageReturn(result, adminCompanyQueryVO)); | |
72 | - } | |
73 | - | |
74 | - /** | |
75 | - * 新增数据 | |
76 | - * | |
77 | - * @param adminCompanyVO 实例对象 | |
78 | - * @return 实例对象 | |
79 | - */ | |
80 | - @Override | |
81 | - public ServerResult add(AdminCompanyVO adminCompanyVO) { | |
82 | - //todo 校验 | |
83 | - if (Objects.nonNull(adminCompanyVO.getId())) { | |
84 | - adminCompanyVO.setId(null); | |
85 | - } | |
86 | - AdminCompanyDO adminCompanyDo = BeanUtil.copyProperties(adminCompanyVO, AdminCompanyDO.class); | |
87 | - | |
88 | - save(adminCompanyDo); | |
89 | - | |
90 | - return ServerResult.success(); | |
91 | - } | |
92 | - | |
93 | - /** | |
94 | - * 修改数据 | |
95 | - * | |
96 | - * @param adminCompanyVO 实例对象 | |
97 | - * @return 实例对象 | |
98 | - */ | |
99 | - @Override | |
100 | - public ServerResult edit(AdminCompanyVO adminCompanyVO) { | |
101 | - //todo 校验 | |
102 | - if (Objects.isNull(adminCompanyVO.getId())) { | |
103 | - return ServerResult.fail("id 不能为空"); | |
104 | - } | |
105 | - AdminCompanyDO adminCompanyDo = BeanUtil.copyProperties(adminCompanyVO, AdminCompanyDO.class); | |
106 | - | |
107 | - updateById(adminCompanyDo); | |
108 | - | |
109 | - return ServerResult.success(); | |
110 | - } | |
111 | - | |
112 | - /** | |
113 | - * 通过主键删除数据 | |
114 | - * | |
115 | - * @param adminCompanyQueryVO 筛选条件 | |
116 | - * @return 是否成功 | |
117 | - */ | |
118 | - @Override | |
119 | - public ServerResult deleteById(AdminCompanyQueryVO adminCompanyQueryVO) { | |
120 | - List<Long> ids = adminCompanyQueryVO.getIds(); | |
121 | - if (CollUtil.isEmpty(ids)) { | |
122 | - return ServerResult.fail("ids 参数不能为空"); | |
123 | - } | |
124 | - List<AdminCompanyDO> adminCompanyList = listByIds(ids); | |
125 | - if (CollUtil.isEmpty(adminCompanyList)) { | |
126 | - return ServerResult.success(); | |
127 | - } | |
128 | - //todo 校验是否可以逻辑删除 | |
129 | - LambdaUpdateWrapper<AdminCompanyDO> updateWrapper = new LambdaUpdateWrapper<AdminCompanyDO>() | |
130 | - .in(AdminCompanyDO::getId, ids) | |
131 | - .set(AdminCompanyDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
132 | - update(updateWrapper); | |
133 | - return ServerResult.success(); | |
134 | - } | |
135 | -} |
src/main/java/com/order/erp/service/admin/impl/AdminDeptServiceImpl.java
... | ... | @@ -4,13 +4,13 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminDeptDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminDeptQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminDeptVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminDeptMapper; | |
13 | -import com.canrd.shop.service.admin.AdminDeptService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.AdminDeptDO; | |
10 | +import com.order.erp.domain.vo.admin.AdminDeptQueryVO; | |
11 | +import com.order.erp.domain.vo.admin.AdminDeptVO; | |
12 | +import com.order.erp.mapper.admin.AdminDeptMapper; | |
13 | +import com.order.erp.service.admin.AdminDeptService; | |
14 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminJobServiceImpl.java
... | ... | @@ -4,13 +4,13 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminJobDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminJobQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminJobVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminJobMapper; | |
13 | -import com.canrd.shop.service.admin.AdminJobService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.AdminJobDO; | |
10 | +import com.order.erp.domain.vo.admin.AdminJobQueryVO; | |
11 | +import com.order.erp.domain.vo.admin.AdminJobVO; | |
12 | +import com.order.erp.mapper.admin.AdminJobMapper; | |
13 | +import com.order.erp.service.admin.AdminJobService; | |
14 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminMenuServiceImpl.java
... | ... | @@ -4,13 +4,13 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminMenuDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminMenuQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminMenuVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminMenuMapper; | |
13 | -import com.canrd.shop.service.admin.AdminMenuService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.AdminMenuDO; | |
10 | +import com.order.erp.domain.vo.admin.AdminMenuQueryVO; | |
11 | +import com.order.erp.domain.vo.admin.AdminMenuVO; | |
12 | +import com.order.erp.mapper.admin.AdminMenuMapper; | |
13 | +import com.order.erp.service.admin.AdminMenuService; | |
14 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminRoleDeptServiceImpl.java
... | ... | @@ -2,15 +2,13 @@ package com.order.erp.service.admin.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
6 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminRoleDeptDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminRoleDeptQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminRoleDeptVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminRoleDeptMapper; | |
13 | -import com.canrd.shop.service.admin.AdminRoleDeptService; | |
6 | +import com.order.erp.common.constant.ServerResult; | |
7 | +import com.order.erp.domain.dto.admin.AdminRoleDeptDO; | |
8 | +import com.order.erp.domain.vo.admin.AdminRoleDeptQueryVO; | |
9 | +import com.order.erp.domain.vo.admin.AdminRoleDeptVO; | |
10 | +import com.order.erp.mapper.admin.AdminRoleDeptMapper; | |
11 | +import com.order.erp.service.admin.AdminRoleDeptService; | |
14 | 12 | import lombok.extern.slf4j.Slf4j; |
15 | 13 | import org.springframework.stereotype.Service; |
16 | 14 | |
... | ... | @@ -115,10 +113,7 @@ public class AdminRoleDeptServiceImpl extends ServiceImpl<AdminRoleDeptMapper, A |
115 | 113 | return ServerResult.success(); |
116 | 114 | } |
117 | 115 | //todo 校验是否可以逻辑删除 |
118 | - LambdaUpdateWrapper<AdminRoleDeptDO> updateWrapper = new LambdaUpdateWrapper<AdminRoleDeptDO>() | |
119 | - .in(AdminRoleDeptDO::getId, ids) | |
120 | - .set(AdminRoleDeptDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
121 | - update(updateWrapper); | |
116 | + removeByIds(ids); | |
122 | 117 | return ServerResult.success(); |
123 | 118 | } |
124 | 119 | } | ... | ... |
src/main/java/com/order/erp/service/impl/VisitsServiceImpl.java renamed to src/main/java/com/order/erp/service/admin/impl/AdminRoleMenuServiceImpl.java
1 | -package com.order.erp.service.impl; | |
1 | +package com.order.erp.service.admin.impl; | |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
5 | -import com.canrd.shop.mapper.VisitsMapper; | |
4 | +import com.order.erp.domain.dto.admin.AdminRoleMenuDO; | |
5 | +import com.order.erp.mapper.admin.AdminRoleMenuMapper; | |
6 | +import com.order.erp.service.admin.AdminRoleMenuService; | |
6 | 7 | import lombok.extern.slf4j.Slf4j; |
7 | 8 | import org.springframework.stereotype.Service; |
8 | 9 | |
9 | 10 | /** |
10 | - * (Visits)表服务实现类 | |
11 | + * 角色-菜单表(AdminRoleMenuDO)表服务实现类 | |
11 | 12 | * |
12 | 13 | * @author makejava |
13 | - * @since 2023-03-30 18:42:35 | |
14 | + * @since 2023-08-30 17:51:48 | |
14 | 15 | */ |
15 | 16 | @Slf4j |
16 | 17 | @Service |
17 | -public class VisitsServiceImpl extends ServiceImpl<VisitsMapper, VisitsDO> implements IService<VisitsDO> { | |
18 | +public class AdminRoleMenuServiceImpl extends ServiceImpl<AdminRoleMenuMapper, AdminRoleMenuDO> implements AdminRoleMenuService { | |
19 | + | |
18 | 20 | |
19 | 21 | } |
22 | + | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminRoleServiceImpl.java
... | ... | @@ -4,13 +4,13 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminRoleDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminRoleQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminRoleVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminRoleMapper; | |
13 | -import com.canrd.shop.service.admin.AdminRoleService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.AdminRoleDO; | |
10 | +import com.order.erp.domain.vo.admin.AdminRoleQueryVO; | |
11 | +import com.order.erp.domain.vo.admin.AdminRoleVO; | |
12 | +import com.order.erp.mapper.admin.AdminRoleMapper; | |
13 | +import com.order.erp.service.admin.AdminRoleService; | |
14 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ... | ... |
src/main/java/com/order/erp/service/impl/RolesDeptsServiceImpl.java renamed to src/main/java/com/order/erp/service/admin/impl/AdminUserJobServiceImpl.java
1 | -package com.order.erp.service.impl; | |
1 | +package com.order.erp.service.admin.impl; | |
2 | 2 | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | 3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
5 | -import com.canrd.shop.domain.dto.RolesDeptsDO; | |
6 | -import com.canrd.shop.mapper.RolesDeptsMapper; | |
4 | +import com.order.erp.domain.dto.admin.AdminUserJobDO; | |
5 | +import com.order.erp.mapper.admin.AdminUserJobMapper; | |
6 | +import com.order.erp.service.admin.AdminUserJobService; | |
7 | 7 | import lombok.extern.slf4j.Slf4j; |
8 | 8 | import org.springframework.stereotype.Service; |
9 | 9 | |
10 | 10 | /** |
11 | - * (RolesDepts)表服务实现类 | |
11 | + * 用户-部门表(AdminRoleDept)表服务实现类 | |
12 | 12 | * |
13 | 13 | * @author makejava |
14 | - * @since 2023-03-30 18:36:35 | |
14 | + * @since 2023-08-30 17:51:48 | |
15 | 15 | */ |
16 | 16 | @Slf4j |
17 | 17 | @Service |
18 | -public class RolesDeptsServiceImpl extends ServiceImpl<RolesDeptsMapper, RolesDeptsDO> implements IService<RolesDeptsDO> { | |
18 | +public class AdminUserJobServiceImpl extends ServiceImpl<AdminUserJobMapper, AdminUserJobDO> implements AdminUserJobService { | |
19 | 19 | |
20 | 20 | |
21 | 21 | } |
22 | + | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminUserRoleServiceImpl.java
... | ... | @@ -2,15 +2,13 @@ package com.order.erp.service.admin.impl; |
2 | 2 | |
3 | 3 | import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
6 | 5 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminUserRoleDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminUserRoleQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminUserRoleVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminUserRoleMapper; | |
13 | -import com.canrd.shop.service.admin.AdminUserRoleService; | |
6 | +import com.order.erp.common.constant.ServerResult; | |
7 | +import com.order.erp.domain.dto.admin.AdminUserRoleDO; | |
8 | +import com.order.erp.domain.vo.admin.AdminUserRoleQueryVO; | |
9 | +import com.order.erp.domain.vo.admin.AdminUserRoleVO; | |
10 | +import com.order.erp.mapper.admin.AdminUserRoleMapper; | |
11 | +import com.order.erp.service.admin.AdminUserRoleService; | |
14 | 12 | import lombok.extern.slf4j.Slf4j; |
15 | 13 | import org.springframework.stereotype.Service; |
16 | 14 | |
... | ... | @@ -114,10 +112,7 @@ public class AdminUserRoleServiceImpl extends ServiceImpl<AdminUserRoleMapper, A |
114 | 112 | return ServerResult.success(); |
115 | 113 | } |
116 | 114 | //todo 校验是否可以逻辑删除 |
117 | - LambdaUpdateWrapper<AdminUserRoleDO> updateWrapper = new LambdaUpdateWrapper<AdminUserRoleDO>() | |
118 | - .in(AdminUserRoleDO::getId, ids) | |
119 | - .set(AdminUserRoleDO::getEnableFlag, Constant.UNABLE_TWENTY); | |
120 | - update(updateWrapper); | |
115 | + removeByIds(ids); | |
121 | 116 | return ServerResult.success(); |
122 | 117 | } |
123 | 118 | } | ... | ... |
src/main/java/com/order/erp/service/admin/impl/AdminUserServiceImpl.java
... | ... | @@ -4,13 +4,14 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.AdminUserDO; | |
10 | -import com.canrd.shop.domain.vo.admin.AdminUserQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.AdminUserVO; | |
12 | -import com.canrd.shop.mapper.admin.AdminUserMapper; | |
13 | -import com.canrd.shop.service.admin.AdminUserService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.AdminUserDO; | |
10 | +import com.order.erp.domain.vo.UserVO; | |
11 | +import com.order.erp.domain.vo.admin.AdminUserQueryVO; | |
12 | +import com.order.erp.domain.vo.admin.AdminUserVO; | |
13 | +import com.order.erp.mapper.admin.AdminUserMapper; | |
14 | +import com.order.erp.service.admin.AdminUserService; | |
14 | 15 | import lombok.extern.slf4j.Slf4j; |
15 | 16 | import org.springframework.stereotype.Service; |
16 | 17 | |
... | ... | @@ -120,4 +121,9 @@ public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser |
120 | 121 | update(updateWrapper); |
121 | 122 | return ServerResult.success(); |
122 | 123 | } |
124 | + | |
125 | + @Override | |
126 | + public UserVO findByUserName(String userName) { | |
127 | + return null; | |
128 | + } | |
123 | 129 | } | ... | ... |
src/main/java/com/order/erp/service/admin/impl/DictionaryServiceImpl.java
... | ... | @@ -4,13 +4,13 @@ import cn.hutool.core.bean.BeanUtil; |
4 | 4 | import cn.hutool.core.collection.CollUtil; |
5 | 5 | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
6 | 6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
7 | -import com.canrd.shop.common.constant.Constant; | |
8 | -import com.canrd.shop.common.constant.ServerResult; | |
9 | -import com.canrd.shop.domain.dto.admin.DictionaryDO; | |
10 | -import com.canrd.shop.domain.vo.admin.DictionaryQueryVO; | |
11 | -import com.canrd.shop.domain.vo.admin.DictionaryVO; | |
12 | -import com.canrd.shop.mapper.admin.DictionaryMapper; | |
13 | -import com.canrd.shop.service.admin.DictionaryService; | |
7 | +import com.order.erp.common.constant.Constant; | |
8 | +import com.order.erp.common.constant.ServerResult; | |
9 | +import com.order.erp.domain.dto.admin.DictionaryDO; | |
10 | +import com.order.erp.domain.vo.admin.DictionaryQueryVO; | |
11 | +import com.order.erp.domain.vo.admin.DictionaryVO; | |
12 | +import com.order.erp.mapper.admin.DictionaryMapper; | |
13 | +import com.order.erp.service.admin.DictionaryService; | |
14 | 14 | import lombok.extern.slf4j.Slf4j; |
15 | 15 | import org.springframework.stereotype.Service; |
16 | 16 | ... | ... |
src/main/java/com/order/erp/service/impl/CompanyServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
5 | -import com.canrd.shop.common.constant.Constant; | |
6 | -import com.canrd.shop.common.constant.ServerResultCode; | |
7 | -import com.canrd.shop.common.exception.BusinessException; | |
8 | -import com.canrd.shop.domain.dto.BaseDO; | |
9 | -import com.canrd.shop.domain.dto.CompanyDO; | |
10 | -import com.canrd.shop.domain.vo.CompanyVO; | |
11 | -import com.canrd.shop.mapper.CompanyMapper; | |
12 | -import com.canrd.shop.service.CompanyService; | |
13 | -import lombok.extern.slf4j.Slf4j; | |
14 | -import org.springframework.beans.BeanUtils; | |
15 | -import org.springframework.stereotype.Service; | |
16 | - | |
17 | -import java.util.Objects; | |
18 | - | |
19 | -/** | |
20 | - * @author: xms | |
21 | - * @description: 公司 | |
22 | - * @date: 2023/1/11 15:55 | |
23 | - * @version: 1.0 | |
24 | - */ | |
25 | -@Slf4j | |
26 | -@Service | |
27 | -public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, CompanyDO> implements CompanyService { | |
28 | - | |
29 | - | |
30 | - @Override | |
31 | - public CompanyVO findByCode(String code) { | |
32 | - LambdaQueryWrapper<CompanyDO> queryWrapper = new LambdaQueryWrapper<CompanyDO>() | |
33 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
34 | - .eq(CompanyDO::getCode, code); | |
35 | - CompanyDO companyDO = getOne(queryWrapper); | |
36 | - if (Objects.isNull(companyDO)) { | |
37 | - throw new BusinessException(ServerResultCode.COMPANY_NOT_EXIT); | |
38 | - } | |
39 | - | |
40 | - CompanyVO companyVO = new CompanyVO(); | |
41 | - BeanUtils.copyProperties(companyDO, companyVO); | |
42 | - return companyVO; | |
43 | - } | |
44 | -} |
src/main/java/com/order/erp/service/impl/DeptServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.DeptDO; | |
5 | -import com.canrd.shop.mapper.DeptMapper; | |
6 | -import com.canrd.shop.service.DeptService; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 部门 | |
13 | - * @date: 2023/1/11 15:55 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class DeptServiceImpl extends ServiceImpl<DeptMapper, DeptDO> implements DeptService { | |
19 | - | |
20 | - | |
21 | -} |
src/main/java/com/order/erp/service/impl/DictDetailServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.DictDetailDO; | |
5 | -import com.canrd.shop.mapper.DictDetailMapper; | |
6 | -import com.canrd.shop.service.DictDetailService; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 字典明细 | |
13 | - * @date: 2023/1/11 15:55 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class DictDetailServiceImpl extends ServiceImpl<DictDetailMapper, DictDetailDO> implements DictDetailService { | |
19 | - | |
20 | - | |
21 | -} |
src/main/java/com/order/erp/service/impl/DictServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.DictDO; | |
5 | -import com.canrd.shop.mapper.DictMapper; | |
6 | -import com.canrd.shop.service.DictService; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 字典 | |
13 | - * @date: 2023/1/11 15:55 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class DictServiceImpl extends ServiceImpl<DictMapper, DictDO> implements DictService { | |
19 | - | |
20 | - | |
21 | -} |
src/main/java/com/order/erp/service/impl/JobServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.JobDO; | |
5 | -import com.canrd.shop.mapper.JobMapper; | |
6 | -import com.canrd.shop.service.JobService; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 岗位 | |
13 | - * @date: 2023/1/11 15:55 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class JobServiceImpl extends ServiceImpl<JobMapper, JobDO> implements JobService { | |
19 | - | |
20 | - | |
21 | -} |
src/main/java/com/order/erp/service/impl/MenuServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.MenuDO; | |
5 | -import com.canrd.shop.mapper.MenuMapper; | |
6 | -import com.canrd.shop.service.MenuService; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * @author: xms | |
12 | - * @description: 菜单 | |
13 | - * @date: 2023/1/11 15:55 | |
14 | - * @version: 1.0 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class MenuServiceImpl extends ServiceImpl<MenuMapper, MenuDO> implements MenuService { | |
19 | - | |
20 | - | |
21 | -} |
src/main/java/com/order/erp/service/impl/RoleServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.domain.dto.RoleDO; | |
5 | -import com.canrd.shop.domain.vo.UserVO; | |
6 | -import com.canrd.shop.mapper.RoleMapper; | |
7 | -import com.canrd.shop.service.RoleService; | |
8 | -import lombok.extern.slf4j.Slf4j; | |
9 | -import org.springframework.security.core.GrantedAuthority; | |
10 | -import org.springframework.stereotype.Service; | |
11 | - | |
12 | -import java.util.Collection; | |
13 | - | |
14 | -/** | |
15 | - * @author: xms | |
16 | - * @description: 角色 | |
17 | - * @date: 2023/1/11 15:55 | |
18 | - * @version: 1.0 | |
19 | - */ | |
20 | -@Slf4j | |
21 | -@Service | |
22 | -public class RoleServiceImpl extends ServiceImpl<RoleMapper, RoleDO> implements RoleService { | |
23 | - | |
24 | - | |
25 | - @Override | |
26 | - public Collection<GrantedAuthority> mapToGrantedAuthorities(UserVO user) { | |
27 | - return null; | |
28 | - } | |
29 | -} |
src/main/java/com/order/erp/service/impl/RolesMenusServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
5 | -import com.canrd.shop.domain.dto.RolesMenusDO; | |
6 | -import com.canrd.shop.mapper.RolesMenusMapper; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * (RolesMenus)表服务实现类 | |
12 | - * | |
13 | - * @author makejava | |
14 | - * @since 2023-03-30 18:41:00 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class RolesMenusServiceImpl extends ServiceImpl<RolesMenusMapper, RolesMenusDO> implements IService<RolesMenusDO> { | |
19 | - | |
20 | -} |
src/main/java/com/order/erp/service/impl/TestServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |
5 | -import com.baomidou.mybatisplus.core.toolkit.StringUtils; | |
6 | -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |
7 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
8 | -import com.canrd.shop.common.constant.Constant; | |
9 | -import com.canrd.shop.common.utils.PageUtils; | |
10 | -import com.canrd.shop.domain.dto.TestDO; | |
11 | -import com.canrd.shop.domain.vo.TestQueryVO; | |
12 | -import com.canrd.shop.domain.vo.TestVO; | |
13 | -import com.canrd.shop.mapper.TestMapper; | |
14 | -import com.canrd.shop.service.TestService; | |
15 | -import lombok.extern.slf4j.Slf4j; | |
16 | -import org.springframework.beans.BeanUtils; | |
17 | -import org.springframework.stereotype.Service; | |
18 | - | |
19 | -import java.util.List; | |
20 | -import java.util.Map; | |
21 | -import java.util.Optional; | |
22 | -import java.util.stream.Collectors; | |
23 | - | |
24 | -/** | |
25 | - * @author: xms | |
26 | - * @description: TODO | |
27 | - * @date: 2023/1/11 15:55 | |
28 | - * @version: 1.0 | |
29 | - */ | |
30 | -@Slf4j | |
31 | -@Service | |
32 | -public class TestServiceImpl extends ServiceImpl<TestMapper, TestDO> implements TestService { | |
33 | - | |
34 | - @Override | |
35 | - public Map<String, Object> pageList(TestQueryVO queryVO) { | |
36 | - | |
37 | - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<TestDO>() | |
38 | - .eq(TestDO::getEnableFlag, Constant.ENABLE_TEN) | |
39 | - .likeLeft(StringUtils.isNotBlank(queryVO.getUserName()), TestDO::getUsername, queryVO.getUserName()) | |
40 | - .eq(StringUtils.isNotBlank(queryVO.getRealName()), TestDO::getRealName, queryVO.getRealName()) | |
41 | - .in(CollectionUtils.isNotEmpty(queryVO.getState()), TestDO::getState, queryVO.getState()) | |
42 | - .orderByDesc(TestDO::getId); | |
43 | - Page<TestDO> pageParam = new Page<>(queryVO.getPageNo(), queryVO.getPageSize()); | |
44 | - Page<TestDO> page = page(pageParam, queryWrapper); | |
45 | - List<TestVO> records = page.getRecords().stream() | |
46 | - .map(this::buildTestVO) | |
47 | - .collect(Collectors.toList()); | |
48 | - | |
49 | - Page<TestVO> HelloVOPage = new Page<>(); | |
50 | - HelloVOPage.setCurrent(page.getCurrent()); | |
51 | - HelloVOPage.setTotal(page.getTotal()); | |
52 | - HelloVOPage.setSize(page.getSize()); | |
53 | - HelloVOPage.setPages(page.getPages()); | |
54 | - HelloVOPage.setRecords(records); | |
55 | - return PageUtils.getUnifiedPageReturn(HelloVOPage); | |
56 | - } | |
57 | - | |
58 | - @Override | |
59 | - public boolean add(TestVO helloVO) { | |
60 | - TestDO helloDO = buildTestDO(helloVO); | |
61 | - return save(helloDO); | |
62 | - } | |
63 | - | |
64 | - /** | |
65 | - * 构建实体类 | |
66 | - * | |
67 | - * @param helloVO | |
68 | - * @return | |
69 | - */ | |
70 | - private TestDO buildTestDO(TestVO helloVO) { | |
71 | - TestDO helloDO = new TestDO(); | |
72 | - BeanUtils.copyProperties(helloVO, helloDO, "id", "state", "createTime", "modifyTime"); | |
73 | - helloDO.setState(Optional.ofNullable(helloVO.getState()) | |
74 | - .map(Integer::valueOf) | |
75 | - .orElse(Constant.ONE)); | |
76 | - helloDO.setCreateBy("xms"); | |
77 | - helloDO.setModifyBy("xms"); | |
78 | - | |
79 | - return helloDO; | |
80 | - } | |
81 | - | |
82 | - /** | |
83 | - * 构建实体类 | |
84 | - * | |
85 | - * @param helloDO | |
86 | - * @return | |
87 | - */ | |
88 | - private TestVO buildTestVO(TestDO helloDO) { | |
89 | - TestVO helloVO = new TestVO(); | |
90 | - BeanUtils.copyProperties(helloDO, helloVO, "id", "state", "createTime", "modifyTime"); | |
91 | - return helloVO; | |
92 | - } | |
93 | - | |
94 | - | |
95 | -} |
src/main/java/com/order/erp/service/impl/UserAvatarServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
4 | -import com.canrd.shop.mapper.UserAvatarMapper; | |
5 | -import com.canrd.shop.service.UserAvatarService; | |
6 | -import lombok.extern.slf4j.Slf4j; | |
7 | -import org.springframework.stereotype.Service; | |
8 | - | |
9 | -/** | |
10 | - * @author: xms | |
11 | - * @description: 用户头像 | |
12 | - * @date: 2023/1/11 15:55 | |
13 | - * @version: 1.0 | |
14 | - */ | |
15 | -@Slf4j | |
16 | -@Service | |
17 | -public class UserAvatarServiceImpl extends ServiceImpl<UserAvatarMapper, UserAvatarDO> implements UserAvatarService { | |
18 | - | |
19 | - | |
20 | -} |
src/main/java/com/order/erp/service/impl/UserServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |
4 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
5 | -import com.canrd.shop.common.constant.Constant; | |
6 | -import com.canrd.shop.common.constant.ServerResultCode; | |
7 | -import com.canrd.shop.common.exception.BusinessException; | |
8 | -import com.canrd.shop.domain.dto.BaseDO; | |
9 | -import com.canrd.shop.domain.dto.UserDO; | |
10 | -import com.canrd.shop.domain.vo.CompanyVO; | |
11 | -import com.canrd.shop.domain.vo.UserVO; | |
12 | -import com.canrd.shop.mapper.UserMapper; | |
13 | -import com.canrd.shop.service.CompanyService; | |
14 | -import com.canrd.shop.service.UserService; | |
15 | -import lombok.extern.slf4j.Slf4j; | |
16 | -import org.springframework.beans.BeanUtils; | |
17 | -import org.springframework.stereotype.Service; | |
18 | - | |
19 | -import javax.annotation.Resource; | |
20 | -import java.util.Objects; | |
21 | - | |
22 | -/** | |
23 | - * @author: xms | |
24 | - * @description: 用户 | |
25 | - * @date: 2023/1/11 15:55 | |
26 | - * @version: 1.0 | |
27 | - */ | |
28 | -@Slf4j | |
29 | -@Service | |
30 | -public class UserServiceImpl extends ServiceImpl<UserMapper, UserDO> implements UserService { | |
31 | - | |
32 | - @Resource | |
33 | - private CompanyService companyService; | |
34 | - | |
35 | - @Override | |
36 | - public UserVO findByName(String userName) { | |
37 | - LambdaQueryWrapper<UserDO> queryWrapper = new LambdaQueryWrapper<UserDO>() | |
38 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
39 | - .and(wrapper -> wrapper.eq(UserDO::getUsername, userName).or().eq(UserDO::getEmail, userName)); | |
40 | - UserDO userDO = getOne(queryWrapper); | |
41 | - if (Objects.isNull(userDO)) { | |
42 | - throw new BusinessException(ServerResultCode.USER_NOT_EXIT); | |
43 | - } | |
44 | - UserVO userVO = new UserVO(); | |
45 | - BeanUtils.copyProperties(userDO, userVO); | |
46 | - return userVO; | |
47 | - } | |
48 | - | |
49 | - @Override | |
50 | - public UserVO findByNameAndCode(String userName, String code) { | |
51 | - CompanyVO companyVO = companyService.findByCode(code); | |
52 | - | |
53 | - LambdaQueryWrapper<UserDO> queryWrapper = new LambdaQueryWrapper<UserDO>() | |
54 | - .eq(BaseDO::getEnableFlag, Constant.ENABLE_TEN) | |
55 | - .and(wrapper -> wrapper.eq(UserDO::getUsername, userName).or().eq(UserDO::getEmail, userName)) | |
56 | - .eq(UserDO::getCompanyId, companyVO.getId()); | |
57 | - UserDO userDO = getOne(queryWrapper); | |
58 | - if (Objects.isNull(userDO)) { | |
59 | - throw new BusinessException(ServerResultCode.USER_NOT_EXIT); | |
60 | - } | |
61 | - UserVO userVO = new UserVO(); | |
62 | - BeanUtils.copyProperties(userDO, userVO); | |
63 | - return userVO; | |
64 | - } | |
65 | -} |
src/main/java/com/order/erp/service/impl/UsersRolesServiceImpl.java deleted
100644 → 0
1 | -package com.order.erp.service.impl; | |
2 | - | |
3 | -import com.baomidou.mybatisplus.extension.service.IService; | |
4 | -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
5 | -import com.canrd.shop.domain.dto.UsersRolesDO; | |
6 | -import com.canrd.shop.mapper.UsersRolesMapper; | |
7 | -import lombok.extern.slf4j.Slf4j; | |
8 | -import org.springframework.stereotype.Service; | |
9 | - | |
10 | -/** | |
11 | - * (UsersRoles)表服务实现类 | |
12 | - * | |
13 | - * @author makejava | |
14 | - * @since 2023-03-30 18:43:10 | |
15 | - */ | |
16 | -@Slf4j | |
17 | -@Service | |
18 | -public class UsersRolesServiceImpl extends ServiceImpl<UsersRolesMapper, UsersRolesDO> implements IService<UsersRolesDO> { | |
19 | - | |
20 | -} |
src/main/resources/application-local.yml
... | ... | @@ -14,7 +14,7 @@ mybatis-plus: |
14 | 14 | logic-delete-value: 20 |
15 | 15 | logic-not-delete-value: 10 |
16 | 16 | mapper-locations: classpath:/mapper/**.xml |
17 | - type-aliases-package: com.canrd.shop.**.dto | |
17 | + type-aliases-package: com.order.erp.**.dto | |
18 | 18 | #spring: |
19 | 19 | # datasource: |
20 | 20 | # dynamic: |
... | ... | @@ -59,7 +59,7 @@ spring: |
59 | 59 | testOnReturn: true |
60 | 60 | password: 123456 |
61 | 61 | time-between-eviction-runs-millis: 1000 |
62 | - url: jdbc:mysql://39.108.227.113:3307/canrd_internal?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true | |
62 | + url: jdbc:mysql://39.108.227.113:3307/order-erp?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&useSSL=false&autoReconnect=true&failOverReadOnly=false&maxReconnects=10&allowMultiQueries=true&useAffectedRows=true&autoReconnectForPools=true | |
63 | 63 | username: root |
64 | 64 | redis: |
65 | 65 | database: 0 |
... | ... | @@ -74,11 +74,52 @@ spring: |
74 | 74 | password: '' |
75 | 75 | port: 6379 |
76 | 76 | timeout: 2000 |
77 | + mail: | |
78 | + # 配置 SMTP 服务器地址 | |
79 | + host: smtp.mxhichina.com | |
80 | + # 发送者邮箱,已开通POP3/SMTP服务的邮箱,也就是你自己的 | |
81 | + username: system@canrd.com | |
82 | + # 配置密码,注意不是真正的密码,而是刚刚申请到的授权码 | |
83 | + password: Kelude2015 | |
84 | + # 邮件接收者 | |
85 | + mailRecipient: #邮件接收者邮箱 | |
86 | + # 端口号465或587(QQ邮箱发送邮件仅支持587端口协议) | |
87 | + port: 587 | |
88 | + # 默认的邮件编码为UTF-8 | |
89 | + default-encoding: UTF-8 | |
90 | + # 配置SSL 加密工厂 | |
91 | + properties: | |
92 | + mail: | |
93 | + smtp: | |
94 | + socketFactoryClass: javax.net.ssl.SSLSocketFactory | |
95 | + #表示开启 DEBUG 模式,这样,邮件发送过程的日志会在控制台打印出来,方便排查错误 | |
96 | + debug: true | |
97 | + | |
98 | + freemarker: | |
99 | + template-loader-path: classpath:/template/ | |
100 | + suffix: .flt | |
101 | + enabled: true | |
102 | + cache: false | |
103 | + charset: UTF-8 | |
104 | + content-type: text/html | |
105 | + allow-request-override: false | |
106 | + check-template-location: true | |
107 | + expose-request-attributes: false | |
108 | + expose-session-attributes: false | |
109 | + expose-spring-macro-helpers: false | |
77 | 110 | |
78 | 111 | |
79 | 112 | logging: |
80 | 113 | config: classpath:log4j2-dev.xml |
81 | 114 | |
115 | +#登录图形验证码有效时间/分钟 | |
116 | +loginCode: | |
117 | + expiration: 2 | |
118 | + | |
119 | +#密码加密传输,前端公钥加密,后端私钥解密 | |
120 | +rsa: | |
121 | + private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== | |
122 | + | |
82 | 123 | |
83 | 124 | #jwt |
84 | 125 | jwt: |
... | ... | @@ -92,4 +133,28 @@ jwt: |
92 | 133 | # 在线用户key |
93 | 134 | online-key: online-token |
94 | 135 | # 验证码 |
95 | - code-key: code-key | |
96 | 136 | \ No newline at end of file |
137 | + code-key: code-key | |
138 | + | |
139 | +outsys: | |
140 | + sms: | |
141 | + regionId: cn-hangzhou | |
142 | + accessKeyId: LTAIZCPI7OaWud0m | |
143 | + secret: nvtGeScBwRztGeoj8WSp5OWalalgpK | |
144 | + domain: dysmsapi.aliyuncs.com | |
145 | + version: 2017-05-25 | |
146 | + action: SendSms | |
147 | + signName: canrd | |
148 | + templateCode: SMS_173005236 | |
149 | + email: | |
150 | + host: http://core.canrd.com | |
151 | + passwordRecoverKey: http://www.canrd.com/canrd/shop/member/passwordModify | |
152 | + | |
153 | + | |
154 | + | |
155 | +system: | |
156 | + isLoginFailureLock: true | |
157 | + loginFailureLockTime: 5 | |
158 | + loginFailureLockCount: 3 | |
159 | + | |
160 | +openai: | |
161 | + token: Bearer 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 | ... | ... |