Merge branch 'master' of http://103.135.160.14:9034/r/se-cloud
已重命名13个文件
已添加18个文件
已修改53个文件
已删除7个文件
| | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | #*.iml |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### JRebel ### |
| | |
| | | # - 7848:7848 |
| | | - 8848:8848 |
| | | - 9848:9848 |
| | | # - 9849:9849 |
| | | # - 9849:9849 |
| | | depends_on: |
| | | - se-mysql |
| | | networks: |
| | |
| | | - ./gateway:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-gateway.jar --spring.config.location=file:/data/ |
| | | entrypoint: /bin/sh -c "sleep 25 && java -jar /data/se-gateway.jar --spring.config.location=file:/data/" |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | # links: |
| | | # - se-redis |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # auth |
| | | se-auth: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9200:9200 |
| | | volumes: |
| | | - ./auth/logs:/logs |
| | | - ./auth:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-auth.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | |
| | | - ./system:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-modules-system.jar --spring.config.location=file:/data/ |
| | | entrypoint: /bin/sh -c "sleep 30 && java -jar /data/se-modules-system.jar --spring.config.location=file:/data/" |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # se-file |
| | | se-file: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9300:9300 |
| | | volumes: |
| | | - ./file/logs:/logs |
| | | - ./file:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-modules-file.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
¶Ô±ÈÐÂÎļþ |
| | |
| | | version : '3.8' |
| | | services: |
| | | # mysql |
| | | se-mysql: |
| | | image: mysql:5.7 |
| | | ports: |
| | | - 3307:3306 |
| | | volumes: |
| | | - ./mysql/logs:/logs |
| | | - ./mysql/data:/var/lib/mysql |
| | | - ./mysql/conf:/etc/mysql/conf.d |
| | | - ./mysql/initdb:/docker-entrypoint-initdb.d |
| | | command: [ |
| | | 'mysqld', |
| | | '--innodb-buffer-pool-size=80M', |
| | | '--character-set-server=utf8mb4', |
| | | '--collation-server=utf8mb4_unicode_ci', |
| | | '--default-time-zone=+8:00', |
| | | '--lower-case-table-names=1' |
| | | ] |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | MYSQL_DATABASE: 'se-cloud' |
| | | MYSQL_ROOT_PASSWORD: My_Sql_s!E_v5.7 |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # nacos |
| | | se-nacos: |
| | | image: nacos/nacos-server:v2.4.1 |
| | | environment: |
| | | MODE: standalone |
| | | TZ: Asia/Shanghai |
| | | volumes: |
| | | - ./nacos/logs/:/home/nacos/logs |
| | | - ./nacos/conf/application.properties:/home/nacos/conf/application.properties |
| | | ports: |
| | | # - 7848:7848 |
| | | - 8848:8848 |
| | | - 9848:9848 |
| | | # - 9849:9849 |
| | | depends_on: |
| | | - se-mysql |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # redis |
| | | se-redis: |
| | | image: redis:latest |
| | | ports: |
| | | - 6379:6379 |
| | | volumes: |
| | | - ./redis/data/redis.conf:/data/redis.conf |
| | | - ./redis/data:/data |
| | | command: redis-server /data/redis.conf |
| | | # command: redis-server --requirepass Redis_s!E_6.2.6 |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # gateway |
| | | se-gateway: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9204:8080 |
| | | volumes: |
| | | - ./gateway/logs:/logs |
| | | - ./gateway:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-gateway.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | # links: |
| | | # - se-redis |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # auth |
| | | se-auth: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9200:9200 |
| | | volumes: |
| | | - ./auth/logs:/logs |
| | | - ./auth:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-auth.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # system |
| | | se-system: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9201:9201 |
| | | volumes: |
| | | - ./system/logs:/logs |
| | | - ./system:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-modules-system.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-redis |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # se-file |
| | | se-file: |
| | | image: openjdk:8-jre |
| | | # ports: |
| | | # - 9300:9300 |
| | | volumes: |
| | | - ./file/logs:/logs |
| | | - ./file:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/se-modules-file.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-mysql |
| | | - se-nacos |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # se-wgcloud |
| | | se-wgcloud: |
| | | image: openjdk:8-jre |
| | | ports: |
| | | - 9999:9999 |
| | | volumes: |
| | | - ./wgcloud/logs:/log |
| | | - ./wgcloud:/data |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | entrypoint: java -jar /data/wgcloud-server-release.jar --spring.config.location=file:/data/ |
| | | depends_on: |
| | | - se-mysql |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # nginx |
| | | se-nginx: |
| | | image: nginx:latest |
| | | ports: |
| | | - 8090:80 |
| | | environment: |
| | | TZ: Asia/Shanghai |
| | | volumes: |
| | | - ./nginx/logs:/var/log/nginx |
| | | - ./nginx/conf.d:/etc/nginx/conf.d |
| | | - ./nginx/html:/usr/share/nginx/html |
| | | - ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf |
| | | depends_on: |
| | | - se-gateway |
| | | networks: |
| | | - network-se |
| | | restart: always |
| | | # networks |
| | | networks: |
| | | network-se: |
| | | driver: bridge |
| | |
| | | ) engine=innodb auto_increment=6 comment = 'åæ°é
置表'; |
| | | |
| | | insert into sys_config values(1, 'ä¸»æ¡æ¶é¡µ-é»è®¤ç®è¤æ ·å¼åç§°', 'sys.index.skinName', 'skin-blue', 'Y', 'admin', sysdate(), '', null, 'èè² skin-blueãç»¿è² skin-greenãç´«è² skin-purpleãçº¢è² skin-redãé»è² skin-yellow' ); |
| | | insert into sys_config values(2, 'ç¨æ·ç®¡ç-è´¦å·åå§å¯ç ', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, 'åå§åå¯ç 123456' ); |
| | | insert into sys_config values(2, 'ç¨æ·ç®¡ç-è´¦å·åå§å¯ç ', 'sys.user.initPassword', '123456', 'Y', 'admin', sysdate(), '', null, 'åå§åå¯ç ' ); |
| | | insert into sys_config values(3, 'ä¸»æ¡æ¶é¡µ-ä¾§è¾¹æ 主é¢', 'sys.index.sideTheme', 'theme-dark', 'Y', 'admin', sysdate(), '', null, 'æ·±è²ä¸»é¢theme-darkï¼æµ
è²ä¸»é¢theme-light' ); |
| | | insert into sys_config values(4, 'è´¦å·èªå©-æ¯å¦å¼å¯ç¨æ·æ³¨ååè½', 'sys.account.registerUser', 'false', 'Y', 'admin', sysdate(), '', null, 'æ¯å¦å¼å¯æ³¨åç¨æ·åè½ï¼trueå¼å¯ï¼falseå
³éï¼'); |
| | | insert into sys_config values(5, 'ç¨æ·ç»å½-é»ååå表', 'sys.login.blackIPList', '', 'Y', 'admin', sysdate(), '', null, '设置ç»å½IPé»ååéå¶ï¼å¤ä¸ªå¹é
项以;åéï¼æ¯æå¹é
ï¼*éé
ãç½æ®µï¼'); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | -- DROP DATABASE IF EXISTS `se-cloud`; |
| | | |
| | | CREATE DATABASE IF NOT EXISTS `se-cloud` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; |
| | | |
| | | SET NAMES utf8mb4; |
| | | SET FOREIGN_KEY_CHECKS = 0; |
| | | |
| | | USE `se-cloud`; |
| | | |
| | | -- ---------------------------- |
| | | -- 01ã软件表 |
| | | -- ---------------------------- |
| | | drop table if exists sys_soft; |
| | | create table sys_soft ( |
| | | soft_id bigint(20) not null auto_increment comment '软件ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | type char(1) default '0' comment 'ç±»åï¼0-åºç¨è½¯ä»¶ï¼1-æ°æ®åºï¼2-ä¸é´ä»¶ï¼3-æä½ç³»ç»ï¼', |
| | | lic varchar(500) comment '许å¯', |
| | | descr varchar(500) comment 'æè¿°', |
| | | args varchar(8000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (soft_id) |
| | | ) engine=innodb auto_increment=1 comment = '软件表'; |
| | | select * from sys_soft order by soft_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 02ã硬件表 |
| | | -- ---------------------------- |
| | | drop table if exists sys_hard; |
| | | create table sys_hard ( |
| | | hard_id bigint(20) not null auto_increment comment '硬件ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | cpu varchar(20) comment 'CPU', |
| | | mem varchar(200) comment 'å
å', |
| | | disk varchar(200) comment '硬ç', |
| | | net varchar(200) comment 'ç½ç»', |
| | | descr varchar(500) comment 'æè¿°', |
| | | args varchar(8000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (hard_id) |
| | | ) engine=innodb auto_increment=1 comment = '硬件表'; |
| | | select * from sys_hard order by hard_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 03ãé
置表 |
| | | -- ---------------------------- |
| | | drop table if exists sys_cfg; |
| | | create table sys_cfg ( |
| | | cfg_id bigint(20) not null auto_increment comment 'é
ç½®ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | hard varchar(4000) comment '硬件', |
| | | soft varchar(4000) comment '软件', |
| | | args varchar(4000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (cfg_id) |
| | | ) engine=innodb auto_increment=1 comment = 'é
置表'; |
| | | select * from sys_cfg order by cfg_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 04ãèµæºè¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_res; |
| | | create table sys_res ( |
| | | res_id bigint(20) not null auto_increment comment 'èµæºID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | type char(1) default '0' comment 'ç±»åï¼0-å
¶å®ï¼1-IPï¼2-æ°æ®åºï¼3-æ¶æ¯ä¸é´ä»¶ï¼4-å
±äº«æä»¶ï¼5-åç³»ç»è½¯ä»¶ï¼6-弿ï¼', |
| | | descr varchar(500) comment 'æè¿°', |
| | | args varchar(4000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (res_id) |
| | | ) engine=innodb auto_increment=1 comment = 'èµæºè¡¨'; |
| | | select * from sys_res order by res_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 05ãæ¥å£è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_inte; |
| | | create table sys_inte ( |
| | | inte_id bigint(20) not null auto_increment comment 'æ¥å£ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | type char(1) default '0' comment 'ç±»å', |
| | | descr varchar(500) comment 'æè¿°', |
| | | url varchar(4000) comment 'URL', |
| | | data varchar(500) comment 'æ°æ®', |
| | | args varchar(4000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (inte_id) |
| | | ) engine=innodb auto_increment=1 comment = 'æ¥å£è¡¨'; |
| | | select * from sys_inte order by inte_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 06ãåè¦è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_warn; |
| | | create table sys_warn ( |
| | | warn_id bigint(20) not null auto_increment comment 'åè¦ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | type char(1) default '0' comment 'ç±»å', |
| | | descr varchar(500) comment 'æè¿°', |
| | | data varchar(500) comment 'æ°æ®', |
| | | args varchar(4000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (warn_id) |
| | | ) engine=innodb auto_increment=1 comment = 'åè¦è¡¨'; |
| | | select * from sys_warn order by warn_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 07ãæ§å¶è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_ctrl; |
| | | create table sys_ctrl ( |
| | | ctrl_id bigint(20) not null auto_increment comment 'æ§å¶ID', |
| | | name varchar(200) not null comment 'åç§°', |
| | | type char(1) default '0' comment 'ç±»å', |
| | | descr varchar(500) comment 'æè¿°', |
| | | data varchar(500) comment 'æ°æ®', |
| | | args varchar(4000) comment 'åæ°', |
| | | status char(1) default 0 comment 'ç¶æï¼0æ£å¸¸ 1åç¨ï¼', |
| | | create_by varchar(64) default '' comment 'å建è
', |
| | | create_time datetime comment 'å建æ¶é´', |
| | | update_by varchar(64) default '' comment 'æ´æ°è
', |
| | | update_time datetime comment 'æ´æ°æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (ctrl_id) |
| | | ) engine=innodb auto_increment=1 comment = 'æ§å¶è¡¨'; |
| | | select * from sys_ctrl order by ctrl_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 08ãæ§å¶æ¥å¿è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_ctrl_log; |
| | | create table sys_ctrl_log ( |
| | | log_id bigint(20) not null auto_increment comment 'æ¥å¿ID', |
| | | title varchar(100) not null comment 'æ é¢', |
| | | type char(1) default '0' comment 'ç±»å', |
| | | ip varchar(50) comment 'IP', |
| | | url varchar(4000) comment 'URL', |
| | | method varchar(20) comment 'æ¹æ³', |
| | | args varchar(4000) comment 'åæ°', |
| | | msg varchar(2000) comment 'æ¶æ¯', |
| | | oper varchar(50) comment 'æä½å', |
| | | time datetime default now() comment 'æä½æ¶é´', |
| | | remark varchar(500) default '' comment '夿³¨', |
| | | primary key (log_id) |
| | | ) engine=innodb auto_increment=1 comment = 'æ§å¶æ¥å¿è¡¨'; |
| | | select * from sys_ctrl_log order by log_id; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 09ãè§è²æ§å¶è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_role_ctrl; |
| | | create table sys_role_ctrl ( |
| | | role_id bigint(20) not null comment 'è§è²ID', |
| | | ctrl_id bigint(20) not null comment 'æ§å¶ID', |
| | | primary key(role_id, ctrl_id) |
| | | ) engine=innodb comment = 'è§è²æ§å¶è¡¨'; |
| | | select * from sys_role_ctrl; |
| | | |
| | | |
| | | -- ---------------------------- |
| | | -- 10ãè§è²æ¥å£è¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_role_inte; |
| | | create table sys_role_inte ( |
| | | role_id bigint(20) not null comment 'è§è²ID', |
| | | inte_id bigint(20) not null comment 'æ¥å£ID', |
| | | primary key(role_id, inte_id) |
| | | ) engine=innodb comment = 'è§è²æ¥å£è¡¨'; |
| | | select * from sys_role_inte; |
| | | |
| | | -- ---------------------------- |
| | | -- 11ãè§è²èµæºè¡¨ |
| | | -- ---------------------------- |
| | | drop table if exists sys_role_res; |
| | | create table sys_role_res ( |
| | | role_id bigint(20) not null comment 'è§è²ID', |
| | | res_id bigint(20) not null comment 'èµæºID', |
| | | primary key(role_id, res_id) |
| | | ) engine=innodb comment = 'è§è²èµæºè¡¨'; |
| | | select * from sys_role_res; |
| | | |
| | |
| | | proxy_set_header REMOTE-HOST $remote_addr; |
| | | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
| | | |
| | | proxy_pass http://se-file:9300/; |
| | | #proxy_pass http://se-file:9300/; |
| | | proxy_pass http://se-system:9201/; |
| | | } |
| | | |
| | | location /prod-api/ { |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-api/se-api-system/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-api/se-api-system/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-api/se-api-system"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-api/se-api-system/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-api/se-api-system/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-api/se-api-system/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * å¥åº·æ§å¶å¨ |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-24 |
| | | */ |
| | | @RestController |
| | | @SuppressWarnings("ALL") |
| | | public class HealthController extends BaseController { |
| | | @GetMapping("/health") |
| | | public long test() { |
| | |
| | | # å
±äº«é
ç½® |
| | | shared-configs: |
| | | - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} |
| | | enableEncrypt: false |
| | | enableEncrypt: true |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-core/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-core/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-core"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-core/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-core/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-core/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | import java.util.Base64; |
| | | |
| | | /** |
| | | * AESå å¯å·¥å
· |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-25 |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | public class AesUtils { |
| | | /** |
| | | * å¯é¥é¿åº¦å¿
é¡»æ¯16 |
| | | */ |
| | | private static final String DEFAULT_KEY = "A#s_zZ3seRve_k.y"; |
| | | |
| | | private static final String KEY_ALGORITHM = "AES"; |
| | | |
| | | /** |
| | | * ç®æ³ |
| | | */ |
| | | private static final String ALGORITHMSTR = "AES/ECB/PKCS5Padding"; |
| | | |
| | | /** |
| | | * aesè§£å¯ |
| | | * |
| | | * @param encrypt å
容 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String encrypt) throws Exception { |
| | | return decrypt(encrypt, DEFAULT_KEY); |
| | | } |
| | | |
| | | /** |
| | | * aeså å¯ |
| | | * |
| | | * @param content å
容 |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public static String encrypt(String content) throws Exception { |
| | | return encrypt(content, DEFAULT_KEY); |
| | | } |
| | | |
| | | /** |
| | | * base 64 encode |
| | | * |
| | | * @param bytes å¾
ç¼ç çbyte[] |
| | | * @return ç¼ç åçbase64 code |
| | | */ |
| | | private static String base64Encode(byte[] bytes) { |
| | | return Base64.getEncoder().encodeToString(bytes); |
| | | } |
| | | |
| | | /** |
| | | * base 64 decode |
| | | * |
| | | * @param base64Code å¾
è§£ç çbase64 code |
| | | * @return è§£ç åçbyte[] |
| | | * @throws Exception |
| | | */ |
| | | private static byte[] base64Decode(String base64Code) { |
| | | return StringUtils.isEmpty(base64Code) ? null : Base64.getDecoder().decode(base64Code); |
| | | } |
| | | |
| | | /** |
| | | * AESå å¯ |
| | | * |
| | | * @param content å¾
å å¯çå
容 |
| | | * @param encryptKey å å¯å¯é¥ |
| | | * @return å å¯åçbyte[] |
| | | * @throws Exception |
| | | */ |
| | | private static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | |
| | | return cipher.doFinal(content.getBytes("utf-8")); |
| | | } |
| | | |
| | | /** |
| | | * AESå å¯ä¸ºbase 64 code |
| | | * |
| | | * @param content å¾
å å¯çå
容 |
| | | * @param encryptKey å å¯å¯é¥ |
| | | * @return å å¯åçbase 64 code |
| | | * @throws Exception |
| | | */ |
| | | public static String encrypt(String content, String encryptKey) throws Exception { |
| | | return base64Encode(aesEncryptToBytes(content, encryptKey)); |
| | | } |
| | | |
| | | /** |
| | | * å°base 64 code AESè§£å¯ |
| | | * |
| | | * @param encryptStr å¾
è§£å¯çbase 64 code |
| | | * @param decryptKey è§£å¯å¯é¥ |
| | | * @return è§£å¯åçstring |
| | | * @throws Exception |
| | | */ |
| | | public static String decrypt(String encryptStr, String decryptKey) throws Exception { |
| | | return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); |
| | | } |
| | | |
| | | /** |
| | | * AESè§£å¯ |
| | | * |
| | | * @param encryptBytes å¾
è§£å¯çbyte[] |
| | | * @param decryptKey è§£å¯å¯é¥ |
| | | * @return è§£å¯åçString |
| | | * @throws Exception |
| | | */ |
| | | private static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * RSAå·¥å
·ç±» |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-25 |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | public class RsaUtils { |
| | | /** |
| | | * ç§é¥ |
| | | */ |
| | | private static String privateKey; |
| | | |
| | | /** |
| | | * å
¬é¥ |
| | | */ |
| | | private static String publicKey; |
| | | |
| | | /** |
| | | * å¯é¥ç®æ³ |
| | | */ |
| | | private static final String KEY_ALGORITHM = "RSA"; |
| | | |
| | | /** |
| | | * RSAå¯é¥é¿åº¦ï¼1024 æ 2048 |
| | | */ |
| | | private static final int DEFAULT_RSA_KEY_SIZE = 1024; |
| | | |
| | | /** |
| | | * æ¥å¿ |
| | | */ |
| | | private static final Logger log = LoggerFactory.getLogger(RsaUtils.class); |
| | | |
| | | /** |
| | | * çæå
¬ç§é¥ |
| | | */ |
| | | public static void generate() { |
| | | Map<String, String> result = generateRsaKey(DEFAULT_RSA_KEY_SIZE); |
| | | System.out.println("å
¬é¥ä¸ºï¼" + result.get("publicKey")); |
| | | System.out.println("ç§é¥ä¸ºï¼" + result.get("privateKey")); |
| | | } |
| | | |
| | | /** |
| | | * è·åRSAå å¯ç§é¥ |
| | | * |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String getPrivateKey() throws IOException { |
| | | if (privateKey == null) { |
| | | InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_private_key.txt").getInputStream(); |
| | |
| | | return privateKey; |
| | | } |
| | | |
| | | /** |
| | | * è·åRSAå å¯å
¬é¥ |
| | | * |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String getPublicKey() throws IOException { |
| | | if (publicKey == null) { |
| | | InputStream inPrivate = new ClassPathResource("config" + File.separator + "rsa_public_key.txt").getInputStream(); |
| | |
| | | return publicKey; |
| | | } |
| | | |
| | | /** |
| | | * è¯»åææ¬æä»¶ |
| | | * |
| | | * @param fileName æä»¶è·¯å¾ |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String readFile(String fileName) throws IOException { |
| | | File file = new File(fileName); |
| | | BufferedReader br = new BufferedReader(new FileReader(file)); |
| | |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * æinputStream转æString |
| | | * |
| | | * @param is |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | private static String inputStream2String(InputStream is) throws IOException { |
| | | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| | | |
| | |
| | | return str; |
| | | } |
| | | |
| | | /** |
| | | * çæRSAçå
¬ç§é¥ |
| | | * |
| | | * @param keySize 1025 æ 2048 |
| | | * @return |
| | | */ |
| | | public static Map<String, String> generateRsaKey(int keySize) { |
| | | Map<String, String> result = new HashMap<>(2); |
| | | try { |
| | | KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM); |
| | | |
| | | // åå§åå¯é¥å¯¹çæå¨ï¼å¯é¥å¤§å°ä¸º1024 2048ä½ |
| | | keyPairGen.initialize(keySize, new SecureRandom()); |
| | | |
| | | // çæä¸ä¸ªå¯é¥å¯¹ï¼ä¿åå¨keyPairä¸ |
| | | KeyPair keyPair = keyPairGen.generateKeyPair(); |
| | | |
| | | // å¾å°å
¬é¥å符串 |
| | | String pub = new String(Base64.encodeBase64(keyPair.getPublic().getEncoded())); |
| | | result.put("publicKey", pub); |
| | | |
| | | // å¾å°ç§é¥å符串 |
| | | String pri = new String(Base64.encodeBase64(keyPair.getPrivate().getEncoded())); |
| | | result.put("privateKey", pri); |
| | | } catch (Exception ex) { |
| | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * RSAç§é¥è§£å¯ |
| | | * |
| | | * @param str å å¯çå符串 |
| | | * @return è§£å¯å符串 |
| | | * @throws Exception å å¯è¿ç¨ä¸çå¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | public static String decrypt(String str) throws Exception { |
| | | // 64ä½è§£ç å å¯åçå符串 |
| | | byte[] inputByte = Base64.decodeBase64(str.getBytes(StandardCharsets.UTF_8)); |
| | | |
| | | // Base64ç¼ç çç§é¥ |
| | | byte[] decoded = Base64.decodeBase64(getPrivateKey()); |
| | | RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded)); |
| | | |
| | | // RSAè§£å¯ï¼RSA/ECB/NoPadding |
| | | // RSA/ECB/NoPadding |
| | | Cipher cipher = Cipher.getInstance("RSA"); |
| | | cipher.init(Cipher.DECRYPT_MODE, priKey); |
| | | |
| | |
| | | return outStr; |
| | | } |
| | | |
| | | /** |
| | | * RSAå
¬é¥å å¯ |
| | | * |
| | | * @param str éè¦å å¯çå符串 |
| | | * @return 坿 |
| | | * @throws Exception å å¯è¿ç¨ä¸çå¼å¸¸ä¿¡æ¯ |
| | | */ |
| | | public static String encrypt(String str) throws Exception { |
| | | // Base64ç¼ç çå
¬é¥ |
| | | byte[] decoded = Base64.decodeBase64(getPublicKey()); |
| | | |
| | | RSAPublicKey pubKey = (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded)); |
| | | |
| | | // RSAå å¯ï¼RSA/ECB/NoPadding |
| | | Cipher cipher = Cipher.getInstance("RSA"); |
| | | cipher.init(Cipher.ENCRYPT_MODE, pubKey); |
| | | |
| | |
| | | * |
| | | * @author admin |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | public class BaseEntity implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | |
| | | private String remark; |
| | | |
| | | /** 请æ±åæ° */ |
| | | //@TableField(exist = false) |
| | | @JsonInclude(JsonInclude.Include.NON_EMPTY) |
| | | private Map<String, Object> params; |
| | | |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-datascope/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-datascope/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-datascope"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-datascope/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-datascope/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-datascope/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-datasource/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-datasource/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-datasource"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-datasource/src/main/java" isTestSource="false" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-datasource/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-log/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-log/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-log"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-log/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-log/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-log/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-redis/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-redis/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-redis"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-redis/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-redis/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-redis/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-seata/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-seata/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-seata"> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-seata/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-security/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-security/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-security"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-security/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-security/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-security/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../../se-common/se-common-swagger/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../../se-common/se-common-swagger/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../../se-common/se-common-swagger"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-swagger/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../../se-common/se-common-swagger/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../../se-common/se-common-swagger/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> |
| | | <output url="file://$MODULE_DIR$/../se-gateway/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/../se-gateway/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$/../se-gateway"> |
| | | <sourceFolder url="file://$MODULE_DIR$/../se-gateway/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/../se-gateway/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/../se-gateway/target" /> |
| | | <output url="file://$MODULE_DIR$/target/classes" /> |
| | | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
| | | <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/target" /> |
| | | </content> |
| | | <orderEntry type="jdk" jdkName="jdk-1.8" jdkType="JavaSDK" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * å¥åº·æ§å¶å¨ |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-24 |
| | | */ |
| | | @RestController |
| | | @SuppressWarnings("ALL") |
| | | @RequestMapping("/gateway") |
| | | public class HealthController extends BaseController { |
| | | @GetMapping("/health") |
| | |
| | | <version>1.18.22</version> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | | <!-- FastDFS --> |
| | | <dependency> |
| | | <groupId>com.github.tobato</groupId> |
| | | <artifactId>fastdfs-client</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- Minio --> |
| | | <dependency> |
| | | <groupId>io.minio</groupId> |
| | | <artifactId>minio</artifactId> |
| | | <version>8.2.2</version> |
| | | <!-- <version>${minio.version}</version>--> |
| | | </dependency> |
| | | |
| | | <!-- SE Api System --> |
| | | <dependency> |
| | | <groupId>com.se</groupId> |
| | | <artifactId>se-api-system</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.config; |
| | | |
| | | import io.minio.MinioClient; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * Minio é
ç½®ä¿¡æ¯ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Configuration |
| | | @ConfigurationProperties(prefix = "minio") |
| | | public class MinioConfig |
| | | { |
| | | /** |
| | | * æå¡å°å |
| | | */ |
| | | private String url; |
| | | |
| | | /** |
| | | * ç¨æ·å |
| | | */ |
| | | private String accessKey; |
| | | |
| | | /** |
| | | * å¯ç |
| | | */ |
| | | private String secretKey; |
| | | |
| | | /** |
| | | * å卿¡¶åç§° |
| | | */ |
| | | private String bucketName; |
| | | |
| | | public String getUrl() |
| | | { |
| | | return url; |
| | | } |
| | | |
| | | public void setUrl(String url) |
| | | { |
| | | this.url = url; |
| | | } |
| | | |
| | | public String getAccessKey() |
| | | { |
| | | return accessKey; |
| | | } |
| | | |
| | | public void setAccessKey(String accessKey) |
| | | { |
| | | this.accessKey = accessKey; |
| | | } |
| | | |
| | | public String getSecretKey() |
| | | { |
| | | return secretKey; |
| | | } |
| | | |
| | | public void setSecretKey(String secretKey) |
| | | { |
| | | this.secretKey = secretKey; |
| | | } |
| | | |
| | | public String getBucketName() |
| | | { |
| | | return bucketName; |
| | | } |
| | | |
| | | public void setBucketName(String bucketName) |
| | | { |
| | | this.bucketName = bucketName; |
| | | } |
| | | |
| | | @Bean |
| | | public MinioClient getMinioClient() |
| | | { |
| | | return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.config; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.CorsRegistry; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * éç¨æ å°é
ç½® |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Configuration |
| | | public class ResourcesConfig implements WebMvcConfigurer |
| | | { |
| | | /** |
| | | * ä¸ä¼ æä»¶åå¨å¨æ¬å°çæ ¹è·¯å¾ |
| | | */ |
| | | @Value("${file.path}") |
| | | private String localFilePath; |
| | | |
| | | /** |
| | | * èµæºæ å°è·¯å¾ åç¼ |
| | | */ |
| | | @Value("${file.prefix}") |
| | | public String localFilePrefix; |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) |
| | | { |
| | | /** æ¬å°æä»¶ä¸ä¼ è·¯å¾ */ |
| | | registry.addResourceHandler(localFilePrefix + "/**") |
| | | .addResourceLocations("file:" + localFilePath + File.separator); |
| | | } |
| | | |
| | | /** |
| | | * å¼å¯è·¨å |
| | | */ |
| | | @Override |
| | | public void addCorsMappings(CorsRegistry registry) { |
| | | // 设置å
许跨åçè·¯ç± |
| | | registry.addMapping(localFilePrefix + "/**") |
| | | // 设置å
许跨å请æ±çåå |
| | | .allowedOrigins("*") |
| | | // 设置å
è®¸çæ¹æ³ |
| | | .allowedMethods("GET"); |
| | | } |
| | | } |
| | |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * å¥åº·æ§å¶å¨ |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-24 |
| | | */ |
| | | @RestController |
| | | @SuppressWarnings("ALL") |
| | | public class HealthController extends BaseController { |
| | | @GetMapping("/health") |
| | | public long test() { |
| | |
| | | |
| | | import com.se.system.domain.SysConfig; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.service.ISysConfigService; |
| | | import com.se.system.service.inte.ISysConfigService; |
| | | |
| | | /** |
| | | * åæ°é
ç½® ä¿¡æ¯æä½å¤ç |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/config") |
| | | public class SysConfigController extends BaseController |
| | | { |
| | | @SuppressWarnings("ALL") |
| | | public class SysConfigController extends BaseController { |
| | | @Value("${enableEncrypt}") |
| | | boolean enableEncrypt; |
| | | |
| | | private final static String PWD_KEY = "sys.user.initPassword"; |
| | | |
| | | @Autowired |
| | | private ISysConfigService configService; |
| | | |
| | |
| | | */ |
| | | @RequiresPermissions("system:config:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysConfig config) |
| | | { |
| | | public TableDataInfo list(SysConfig config) throws Exception { |
| | | startPage(); |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | /*if (enableEncrypt && null != list) { |
| | | for (SysConfig cfg : list) { |
| | | if (null != cfg && PWD_KEY.equals(cfg.getConfigKey()) && !StringUtils.isEmpty(cfg.getConfigValue())) { |
| | | cfg.setConfigValue(AesUtils.encrypt(cfg.getConfigValue())); |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @RequiresPermissions("system:config:export") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysConfig config) |
| | | { |
| | | public void export(HttpServletResponse response, SysConfig config) { |
| | | List<SysConfig> list = configService.selectConfigList(config); |
| | | /*if (enableEncrypt && null != list) { |
| | | for (SysConfig cfg : list) { |
| | | if (null != cfg && PWD_KEY.equals(cfg.getConfigKey()) && !StringUtils.isEmpty(cfg.getConfigValue())) { |
| | | cfg.setConfigValue(AesUtils.encrypt(cfg.getConfigValue())); |
| | | } |
| | | } |
| | | }*/ |
| | | |
| | | ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class); |
| | | util.exportExcel(response, list, "åæ°æ°æ®"); |
| | | } |
| | |
| | | * æ ¹æ®åæ°ç¼å·è·å详ç»ä¿¡æ¯ |
| | | */ |
| | | @GetMapping(value = "/{configId}") |
| | | public AjaxResult getInfo(@PathVariable Long configId) |
| | | { |
| | | return success(configService.selectConfigById(configId)); |
| | | public AjaxResult getInfo(@PathVariable Long configId) throws Exception { |
| | | SysConfig config = configService.selectConfigById(configId); |
| | | /*if ((enableEncrypt && null != config && PWD_KEY.equals(config.getConfigKey()) && !StringUtils.isEmpty(config.getConfigValue())) { |
| | | config.setConfigValue(AesUtils.encrypt(config.getConfigValue())); |
| | | }*/ |
| | | |
| | | return success(config); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åæ°é®åæ¥è¯¢åæ°å¼ |
| | | */ |
| | | @GetMapping(value = "/configKey/{configKey}") |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) |
| | | { |
| | | return success(configService.selectConfigByKey(configKey)); |
| | | public AjaxResult getConfigKey(@PathVariable String configKey) throws Exception { |
| | | String val = configService.selectConfigByKey(configKey); |
| | | /*if (enableEncrypt && PWD_KEY.equals(configKey) && !StringUtils.isEmpty(val)) { |
| | | val = AesUtils.encrypt(val); |
| | | }*/ |
| | | |
| | | return success(val); |
| | | } |
| | | |
| | | /** |
| | |
| | | @RequiresPermissions("system:config:add") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | public AjaxResult add(@Validated @RequestBody SysConfig config) { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("æ°å¢åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setCreateBy(SecurityUtils.getUsername()); |
| | |
| | | @RequiresPermissions("system:config:edit") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) |
| | | { |
| | | if (!configService.checkConfigKeyUnique(config)) |
| | | { |
| | | public AjaxResult edit(@Validated @RequestBody SysConfig config) throws Exception { |
| | | if (!configService.checkConfigKeyUnique(config)) { |
| | | return error("ä¿®æ¹åæ°'" + config.getConfigName() + "'失败ï¼åæ°é®åå·²åå¨"); |
| | | } |
| | | config.setUpdateBy(SecurityUtils.getUsername()); |
| | | /*if ((enableEncrypt && PWD_KEY.equals(config.getConfigKey()) && !StringUtils.isEmpty(config.getConfigValue())){ |
| | | config.setConfigValue(AesUtils.decrypt(config.getConfigValue())); |
| | | }*/ |
| | | |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{configIds}") |
| | | public AjaxResult remove(@PathVariable Long[] configIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] configIds) { |
| | | configService.deleteConfigByIds(configIds); |
| | | return success(); |
| | | } |
| | |
| | | @RequiresPermissions("system:config:remove") |
| | | @Log(title = "åæ°ç®¡ç", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult refreshCache() |
| | | { |
| | | public AjaxResult refreshCache() { |
| | | configService.resetConfigCache(); |
| | | return success(); |
| | | } |
| | |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysDept; |
| | | import com.se.system.service.ISysDeptService; |
| | | import com.se.system.service.inte.ISysDeptService; |
| | | |
| | | /** |
| | | * é¨é¨ä¿¡æ¯ |
| | |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysDictData; |
| | | import com.se.system.service.ISysDictDataService; |
| | | import com.se.system.service.ISysDictTypeService; |
| | | import com.se.system.service.inte.ISysDictDataService; |
| | | import com.se.system.service.inte.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
| | |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysDictType; |
| | | import com.se.system.service.ISysDictTypeService; |
| | | import com.se.system.service.inte.ISysDictTypeService; |
| | | |
| | | /** |
| | | * æ°æ®åå
¸ä¿¡æ¯ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.controller; |
| | | |
| | | import com.se.common.core.domain.R; |
| | | import com.se.common.core.utils.file.FileUtils; |
| | | import com.se.system.api.domain.SysFile; |
| | | import com.se.system.service.inte.ISysFileService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * æä»¶è¯·æ±å¤ç |
| | | * |
| | | * @author admin |
| | | */ |
| | | @RestController |
| | | public class SysFileController |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(SysFileController.class); |
| | | |
| | | @Resource |
| | | private ISysFileService sysFileService; |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ è¯·æ± |
| | | */ |
| | | @PostMapping("upload") |
| | | public R<SysFile> upload(MultipartFile file) |
| | | { |
| | | try |
| | | { |
| | | // ä¸ä¼ å¹¶è¿å访é®å°å |
| | | String url = sysFileService.uploadFile(file); |
| | | SysFile sysFile = new SysFile(); |
| | | sysFile.setName(FileUtils.getName(url)); |
| | | sysFile.setUrl(url); |
| | | return R.ok(sysFile); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("ä¸ä¼ æä»¶å¤±è´¥", e); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.se.common.security.annotation.InnerAuth; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.system.api.domain.SysLogininfor; |
| | | import com.se.system.service.ISysLogininforService; |
| | | import com.se.system.service.inte.ISysLogininforService; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®è®°å½ |
| | |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.service.ISysMenuService; |
| | | import com.se.system.service.inte.ISysMenuService; |
| | | |
| | | /** |
| | | * èåä¿¡æ¯ |
| | |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.service.ISysNoticeService; |
| | | import com.se.system.service.inte.ISysNoticeService; |
| | | |
| | | /** |
| | | * å
¬å ä¿¡æ¯æä½å¤ç |
| | |
| | | import com.se.common.security.annotation.InnerAuth; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.system.api.domain.SysOperLog; |
| | | import com.se.system.service.ISysOperLogService; |
| | | import com.se.system.service.inte.ISysOperLogService; |
| | | |
| | | /** |
| | | * æä½æ¥å¿è®°å½ |
| | |
| | | import com.se.common.log.enums.BusinessType; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.service.ISysPostService; |
| | | import com.se.system.service.inte.ISysPostService; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯æä½å¤ç |
| | |
| | | import com.se.system.api.domain.SysFile; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.service.ISysUserService; |
| | | import com.se.system.service.inte.ISysUserService; |
| | | |
| | | /** |
| | | * ä¸ªäººä¿¡æ¯ ä¸å¡å¤ç |
| | |
| | | @Log(title = "个人信æ¯", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updatePwd") |
| | | public AjaxResult updatePwd(String oldPassword, String newPassword) throws Exception { |
| | | if (enableEncrypt) { |
| | | oldPassword = AesUtils.decrypt(oldPassword); |
| | | newPassword = AesUtils.decrypt(newPassword); |
| | | } |
| | | |
| | | String username = SecurityUtils.getUsername(); |
| | | SysUser user = userService.selectUserByUserName(username); |
| | | if (enableEncrypt && !StringUtils.isEmpty(user.getPassword())) { |
| | | user.setPassword(AesUtils.decrypt(user.getPassword())); |
| | | } |
| | | String password = user.getPassword(); |
| | | if (!SecurityUtils.matchesPassword(oldPassword, password)) { |
| | | return error("ä¿®æ¹å¯ç å¤±è´¥ï¼æ§å¯ç é误"); |
| | |
| | | import com.se.system.api.domain.SysDept; |
| | | import com.se.system.api.domain.SysRole; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.service.ISysDeptService; |
| | | import com.se.system.service.ISysRoleService; |
| | | import com.se.system.service.ISysUserService; |
| | | import com.se.system.service.inte.ISysDeptService; |
| | | import com.se.system.service.inte.ISysRoleService; |
| | | import com.se.system.service.inte.ISysUserService; |
| | | |
| | | /** |
| | | * è§è²ä¿¡æ¯ |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.se.common.core.utils.AesUtils; |
| | | import com.se.system.service.inte.*; |
| | | import org.apache.commons.lang3.ArrayUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | import com.se.system.api.domain.SysRole; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.service.*; |
| | | |
| | | /** |
| | | * ç¨æ·ä¿¡æ¯ |
| | |
| | | import com.se.common.redis.service.RedisService; |
| | | import com.se.common.security.annotation.RequiresPermissions; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.service.ISysUserOnlineService; |
| | | import com.se.system.service.inte.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * å¨çº¿ç¨æ·çæ§ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.controller; |
| | | |
| | | import com.se.common.core.domain.R; |
| | | import com.se.common.core.utils.AesUtils; |
| | | import com.se.common.core.utils.JwtUtils; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.security.auth.AuthUtil; |
| | | import com.se.common.security.service.TokenService; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.domain.LoginBody; |
| | | import com.se.system.service.SysLoginService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * token æ§å¶ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @RestController |
| | | public class TokenController { |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @Autowired |
| | | private SysLoginService sysLoginService; |
| | | |
| | | @Value("${enableEncrypt}") |
| | | boolean enableEncrypt; |
| | | |
| | | @PostMapping("login") |
| | | public R<?> login(@RequestBody LoginBody form) throws Exception { |
| | | if (enableEncrypt && !StringUtils.isEmpty(form.getPassword())) { |
| | | form.setPassword(AesUtils.decrypt(form.getPassword())); |
| | | } |
| | | // ç¨æ·ç»å½ |
| | | LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword()); |
| | | // è·åç»å½token |
| | | return R.ok(tokenService.createToken(userInfo)); |
| | | } |
| | | |
| | | @GetMapping("validate") |
| | | @PostMapping("validate") |
| | | public R<Object> validate(HttpServletRequest request) { |
| | | try { |
| | | boolean flag = false; |
| | | String token = SecurityUtils.getToken(request); |
| | | if (!StringUtils.isNotEmpty(token)) { |
| | | String userName = JwtUtils.getUserName(token); |
| | | flag = !StringUtils.isEmpty(userName); |
| | | } |
| | | |
| | | return R.ok(flag); |
| | | } catch (Exception ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @DeleteMapping("logout") |
| | | public R<?> logout(HttpServletRequest request) { |
| | | String token = SecurityUtils.getToken(request); |
| | | if (StringUtils.isNotEmpty(token)) { |
| | | String username = JwtUtils.getUserName(token); |
| | | // å é¤ç¨æ·ç¼åè®°å½ |
| | | AuthUtil.logoutByToken(token); |
| | | // è®°å½ç¨æ·éåºæ¥å¿ |
| | | sysLoginService.logout(username); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("refresh") |
| | | public R<?> refresh(HttpServletRequest request) { |
| | | LoginUser loginUser = tokenService.getLoginUser(request); |
| | | if (StringUtils.isNotNull(loginUser)) { |
| | | // å·æ°ä»¤çæææ |
| | | tokenService.refreshToken(loginUser); |
| | | return R.ok(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /*@PostMapping("register") |
| | | public R<?> register(@RequestBody RegisterBody registerBody) |
| | | { |
| | | // ç¨æ·æ³¨å |
| | | sysLoginService.register(registerBody.getUsername(), registerBody.getPassword()); |
| | | return R.ok(); |
| | | }*/ |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.domain; |
| | | |
| | | /** |
| | | * ç¨æ·ç»å½å¯¹è±¡ |
| | | * |
| | | * @author admin |
| | | */ |
| | | public class LoginBody |
| | | { |
| | | /** |
| | | * ç¨æ·å |
| | | */ |
| | | private String username; |
| | | |
| | | /** |
| | | * ç¨æ·å¯ç |
| | | */ |
| | | private String password; |
| | | |
| | | public String getUsername() |
| | | { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) |
| | | { |
| | | this.username = username; |
| | | } |
| | | |
| | | public String getPassword() |
| | | { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) |
| | | { |
| | | this.password = password; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.domain; |
| | | |
| | | /** |
| | | * ç¨æ·æ³¨å对象 |
| | | * |
| | | * @author admin |
| | | */ |
| | | public class RegisterBody extends LoginBody |
| | | { |
| | | |
| | | } |
| | |
| | | /** |
| | | * æ ¹æ®ç¨æ·æ¥è¯¢ç³»ç»èåå表 |
| | | * |
| | | * @param menu èåä¿¡æ¯ |
| | | * @param menu èåä¿¡æ¯ |
| | | * @return èåå表 |
| | | */ |
| | | public List<SysMenu> selectMenuListByUserId(SysMenu menu); |
| | |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢èå |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @param mark æ è¯ |
| | | * @param mark èåæ è¯ |
| | | * @return èåå表 |
| | | */ |
| | | public List<SysMenu> selectMenuTreeByUserId(@Param("userId") Long userId, @Param("mark") String mark); |
| | |
| | | * æ ¹æ®ç¨æ·IDåæ è¯æ¥è¯¢èå |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @param mark æ è¯ |
| | | * @param mark èåæ è¯ |
| | | * @return èåéå |
| | | */ |
| | | List<SysMenu> selectMenusByUserIdAndMark(@Param("userId") Long userId, @Param("mark") String mark); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service; |
| | | |
| | | import com.se.common.core.constant.CacheConstants; |
| | | import com.se.common.core.constant.Constants; |
| | | import com.se.common.core.constant.SecurityConstants; |
| | | import com.se.common.core.constant.UserConstants; |
| | | import com.se.common.core.domain.R; |
| | | import com.se.common.core.enums.UserStatus; |
| | | import com.se.common.core.exception.ServiceException; |
| | | import com.se.common.core.text.Convert; |
| | | import com.se.common.core.utils.DateUtils; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.core.utils.ip.IpUtils; |
| | | import com.se.common.redis.service.RedisService; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.RemoteUserService; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.api.model.LoginUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * ç»å½æ ¡éªæ¹æ³ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Component |
| | | public class SysLoginService |
| | | { |
| | | @Autowired |
| | | private RemoteUserService remoteUserService; |
| | | |
| | | @Autowired |
| | | private SysPasswordService passwordService; |
| | | |
| | | @Autowired |
| | | private SysRecordLogService recordLogService; |
| | | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * ç»å½ |
| | | */ |
| | | public LoginUser login(String username, String password) |
| | | { |
| | | // ç¨æ·åæå¯ç 为空 é误 |
| | | if (StringUtils.isAnyBlank(username, password)) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "ç¨æ·/å¯ç å¿
须填å"); |
| | | throw new ServiceException("ç¨æ·/å¯ç å¿
须填å"); |
| | | } |
| | | // å¯ç 妿ä¸å¨æå®èå´å
é误 |
| | | if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "ç¨æ·å¯ç ä¸å¨æå®èå´"); |
| | | throw new ServiceException("ç¨æ·å¯ç ä¸å¨æå®èå´"); |
| | | } |
| | | // ç¨æ·åä¸å¨æå®èå´å
é误 |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "ç¨æ·åä¸å¨æå®èå´"); |
| | | throw new ServiceException("ç¨æ·åä¸å¨æå®èå´"); |
| | | } |
| | | // IPé»ååæ ¡éª |
| | | String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); |
| | | if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "å¾éæ¾ï¼è®¿é®IP已被åå
¥ç³»ç»é»åå"); |
| | | throw new ServiceException("å¾éæ¾ï¼è®¿é®IP已被åå
¥ç³»ç»é»åå"); |
| | | } |
| | | // æ¥è¯¢ç¨æ·ä¿¡æ¯ |
| | | R<LoginUser> userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); |
| | | |
| | | if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "ç»å½ç¨æ·ä¸åå¨"); |
| | | throw new ServiceException("ç»å½ç¨æ·ï¼" + username + " ä¸åå¨"); |
| | | } |
| | | |
| | | if (R.FAIL == userResult.getCode()) |
| | | { |
| | | throw new ServiceException(userResult.getMsg()); |
| | | } |
| | | |
| | | LoginUser userInfo = userResult.getData(); |
| | | SysUser user = userResult.getData().getSysUser(); |
| | | if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "对ä¸èµ·ï¼æ¨çè´¦å·å·²è¢«å é¤"); |
| | | throw new ServiceException("对ä¸èµ·ï¼æ¨çè´¦å·ï¼" + username + " 已被å é¤"); |
| | | } |
| | | if (UserStatus.DISABLE.getCode().equals(user.getStatus())) |
| | | { |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, "ç¨æ·å·²åç¨ï¼è¯·è系管çå"); |
| | | throw new ServiceException("对ä¸èµ·ï¼æ¨çè´¦å·ï¼" + username + " å·²åç¨"); |
| | | } |
| | | passwordService.validate(user, password); |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_SUCCESS, "ç»å½æå"); |
| | | recordLoginInfo(user.getUserId()); |
| | | return userInfo; |
| | | } |
| | | |
| | | /** |
| | | * è®°å½ç»å½ä¿¡æ¯ |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | */ |
| | | public void recordLoginInfo(Long userId) |
| | | { |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserId(userId); |
| | | // æ´æ°ç¨æ·ç»å½IP |
| | | sysUser.setLoginIp(IpUtils.getIpAddr()); |
| | | // æ´æ°ç¨æ·ç»å½æ¶é´ |
| | | sysUser.setLoginDate(DateUtils.getNowDate()); |
| | | remoteUserService.recordUserLogin(sysUser, SecurityConstants.INNER); |
| | | } |
| | | |
| | | public void logout(String loginName) |
| | | { |
| | | recordLogService.recordLogininfor(loginName, Constants.LOGOUT, "éåºæå"); |
| | | } |
| | | |
| | | /** |
| | | * 注å |
| | | */ |
| | | public void register(String username, String password) |
| | | { |
| | | // ç¨æ·åæå¯ç 为空 é误 |
| | | if (StringUtils.isAnyBlank(username, password)) |
| | | { |
| | | throw new ServiceException("ç¨æ·/å¯ç å¿
须填å"); |
| | | } |
| | | if (username.length() < UserConstants.USERNAME_MIN_LENGTH |
| | | || username.length() > UserConstants.USERNAME_MAX_LENGTH) |
| | | { |
| | | throw new ServiceException("è´¦æ·é¿åº¦å¿
é¡»å¨2å°20个å符ä¹é´"); |
| | | } |
| | | if (password.length() < UserConstants.PASSWORD_MIN_LENGTH |
| | | || password.length() > UserConstants.PASSWORD_MAX_LENGTH) |
| | | { |
| | | throw new ServiceException("å¯ç é¿åº¦å¿
é¡»å¨5å°20个å符ä¹é´"); |
| | | } |
| | | |
| | | // 注åç¨æ·ä¿¡æ¯ |
| | | SysUser sysUser = new SysUser(); |
| | | sysUser.setUserName(username); |
| | | sysUser.setNickName(username); |
| | | sysUser.setPassword(SecurityUtils.encryptPassword(password)); |
| | | R<?> registerResult = remoteUserService.registerUserInfo(sysUser, SecurityConstants.INNER); |
| | | |
| | | if (R.FAIL == registerResult.getCode()) |
| | | { |
| | | throw new ServiceException(registerResult.getMsg()); |
| | | } |
| | | recordLogService.recordLogininfor(username, Constants.REGISTER, "注åæå"); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service; |
| | | |
| | | import com.se.common.core.constant.CacheConstants; |
| | | import com.se.common.core.constant.Constants; |
| | | import com.se.common.core.exception.ServiceException; |
| | | import com.se.common.redis.service.RedisService; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysUser; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * ç»å½å¯ç æ¹æ³ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Component |
| | | @SuppressWarnings("ALL") |
| | | public class SysPasswordService |
| | | { |
| | | @Autowired |
| | | private RedisService redisService; |
| | | |
| | | private int maxRetryCount = CacheConstants.PASSWORD_MAX_RETRY_COUNT; |
| | | |
| | | private Long lockTime = CacheConstants.PASSWORD_LOCK_TIME; |
| | | |
| | | @Autowired |
| | | private SysRecordLogService recordLogService; |
| | | |
| | | /** |
| | | * ç»å½è´¦æ·å¯ç é误次æ°ç¼åé®å |
| | | * |
| | | * @param username ç¨æ·å |
| | | * @return ç¼åé®key |
| | | */ |
| | | private String getCacheKey(String username) |
| | | { |
| | | return CacheConstants.PWD_ERR_CNT_KEY + username; |
| | | } |
| | | |
| | | public void validate(SysUser user, String password) |
| | | { |
| | | String username = user.getUserName(); |
| | | |
| | | Integer retryCount = redisService.getCacheObject(getCacheKey(username)); |
| | | |
| | | if (retryCount == null) |
| | | { |
| | | retryCount = 0; |
| | | } |
| | | |
| | | /*if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) |
| | | { |
| | | String errMsg = String.format("å¯ç è¾å
¥é误%s次ï¼å¸æ·éå®%såé", maxRetryCount, lockTime); |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL,errMsg); |
| | | throw new ServiceException(errMsg); |
| | | }*/ |
| | | |
| | | if (!matches(user, password)) |
| | | { |
| | | retryCount = retryCount + 1; |
| | | recordLogService.recordLogininfor(username, Constants.LOGIN_FAIL, String.format("å¯ç è¾å
¥é误%s次", retryCount)); |
| | | redisService.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); |
| | | throw new ServiceException("ç¨æ·ä¸åå¨/å¯ç é误"); |
| | | } |
| | | else |
| | | { |
| | | clearLoginRecordCache(username); |
| | | } |
| | | } |
| | | |
| | | public boolean matches(SysUser user, String rawPassword) |
| | | { |
| | | return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); |
| | | } |
| | | |
| | | public void clearLoginRecordCache(String loginName) |
| | | { |
| | | if (redisService.hasKey(getCacheKey(loginName))) |
| | | { |
| | | redisService.deleteObject(getCacheKey(loginName)); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service; |
| | | |
| | | import com.se.common.core.constant.Constants; |
| | | import com.se.common.core.constant.SecurityConstants; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.core.utils.ip.IpUtils; |
| | | import com.se.system.api.RemoteLogService; |
| | | import com.se.system.api.domain.SysLogininfor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * è®°å½æ¥å¿æ¹æ³ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Component |
| | | public class SysRecordLogService |
| | | { |
| | | @Autowired |
| | | private RemoteLogService remoteLogService; |
| | | |
| | | /** |
| | | * è®°å½ç»å½ä¿¡æ¯ |
| | | * |
| | | * @param username ç¨æ·å |
| | | * @param status ç¶æ |
| | | * @param message æ¶æ¯å
容 |
| | | * @return |
| | | */ |
| | | public void recordLogininfor(String username, String status, String message) |
| | | { |
| | | SysLogininfor logininfor = new SysLogininfor(); |
| | | logininfor.setUserName(username); |
| | | logininfor.setIpaddr(IpUtils.getIpAddr()); |
| | | logininfor.setMsg(message); |
| | | // æ¥å¿ç¶æ |
| | | if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) |
| | | { |
| | | logininfor.setStatus(Constants.LOGIN_SUCCESS_STATUS); |
| | | } |
| | | else if (Constants.LOGIN_FAIL.equals(status)) |
| | | { |
| | | logininfor.setStatus(Constants.LOGIN_FAIL_STATUS); |
| | | } |
| | | remoteLogService.saveLogininfor(logininfor, SecurityConstants.INNER); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.IoUtils; |
| | | import com.github.tobato.fastdfs.domain.fdfs.StorePath; |
| | | import com.github.tobato.fastdfs.service.FastFileStorageClient; |
| | | import com.se.common.core.utils.file.FileTypeUtils; |
| | | import com.se.system.service.inte.ISysFileService; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * FastDFS æä»¶åå¨ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Service |
| | | public class FastDfsSysFileServiceImpl implements ISysFileService |
| | | { |
| | | /** |
| | | * ååææ¬æºè®¿é®å°å |
| | | */ |
| | | @Value("${fdfs.domain}") |
| | | public String domain; |
| | | |
| | | @Resource |
| | | private FastFileStorageClient storageClient; |
| | | |
| | | /** |
| | | * FastDfsæä»¶ä¸ä¼ æ¥å£ |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return 访é®å°å |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public String uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | InputStream inputStream = file.getInputStream(); |
| | | StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), |
| | | FileTypeUtils.getExtension(file), null); |
| | | IoUtils.closeQuietly(inputStream); |
| | | return domain + "/" + storePath.getFullPath(); |
| | | } |
| | | } |
| | |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ISIMç¨æ·æå¡ |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-30 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import com.se.system.service.inte.ISysFileService; |
| | | import com.se.system.utils.FileUploadUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Primary; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * æ¬å°æä»¶åå¨ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Primary |
| | | @Service |
| | | public class LocalSysFileServiceImpl implements ISysFileService |
| | | { |
| | | /** |
| | | * èµæºæ å°è·¯å¾ åç¼ |
| | | */ |
| | | @Value("${file.prefix}") |
| | | public String localFilePrefix; |
| | | |
| | | /** |
| | | * ååææ¬æºè®¿é®å°å |
| | | */ |
| | | @Value("${file.domain}") |
| | | public String domain; |
| | | |
| | | /** |
| | | * ä¸ä¼ æä»¶åå¨å¨æ¬å°çæ ¹è·¯å¾ |
| | | */ |
| | | @Value("${file.path}") |
| | | private String localFilePath; |
| | | |
| | | /** |
| | | * æ¬å°æä»¶ä¸ä¼ æ¥å£ |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return 访é®å°å |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public String uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | String name = FileUploadUtils.upload(localFilePath, file); |
| | | String url = domain + localFilePrefix + name; |
| | | return url; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.IoUtils; |
| | | import com.se.system.config.MinioConfig; |
| | | import com.se.system.service.inte.ISysFileService; |
| | | import com.se.system.utils.FileUploadUtils; |
| | | import io.minio.MinioClient; |
| | | import io.minio.PutObjectArgs; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * Minio æä»¶åå¨ |
| | | * |
| | | * @author admin |
| | | */ |
| | | @Service |
| | | public class MinioSysFileServiceImpl implements ISysFileService |
| | | { |
| | | @Resource |
| | | private MinioConfig minioConfig; |
| | | |
| | | @Resource |
| | | private MinioClient client; |
| | | |
| | | /** |
| | | * Minioæä»¶ä¸ä¼ æ¥å£ |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return 访é®å°å |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public String uploadFile(MultipartFile file) throws Exception |
| | | { |
| | | String fileName = FileUploadUtils.extractFilename(file); |
| | | InputStream inputStream = file.getInputStream(); |
| | | PutObjectArgs args = PutObjectArgs.builder() |
| | | .bucket(minioConfig.getBucketName()) |
| | | .object(fileName) |
| | | .stream(inputStream, file.getSize(), -1) |
| | | .contentType(file.getContentType()) |
| | | .build(); |
| | | client.putObject(args); |
| | | IoUtils.closeQuietly(inputStream); |
| | | return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; |
| | | } |
| | | } |
| | |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | |
| | | /** |
| | | * ç¨æ·åæ¥æå¡ |
| | | * |
| | | * @author WWW |
| | | * @date 2024-08-30 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | |
| | | IsimUserService isimUserService; |
| | | |
| | | public void insertUser(SysUser user) { |
| | | // supplyAsync-带è¿åå¼ï¼runAsync-æ è¿åå¼ |
| | | CompletableFuture.runAsync(() -> { |
| | | isimUserService.insertUser(user); |
| | | }); |
| | |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.redis.service.RedisService; |
| | | import com.se.system.mapper.SysConfigMapper; |
| | | import com.se.system.service.ISysConfigService; |
| | | import com.se.system.service.inte.ISysConfigService; |
| | | |
| | | /** |
| | | * åæ°é
ç½® æå¡å±å®ç° |
| | |
| | | import com.se.system.domain.vo.TreeSelect; |
| | | import com.se.system.mapper.SysDeptMapper; |
| | | import com.se.system.mapper.SysRoleMapper; |
| | | import com.se.system.service.ISysDeptService; |
| | | import com.se.system.service.inte.ISysDeptService; |
| | | |
| | | /** |
| | | * é¨é¨ç®¡ç æå¡å®ç° |
| | |
| | | import com.se.common.security.utils.DictUtils; |
| | | import com.se.system.api.domain.SysDictData; |
| | | import com.se.system.mapper.SysDictDataMapper; |
| | | import com.se.system.service.ISysDictDataService; |
| | | import com.se.system.service.inte.ISysDictDataService; |
| | | |
| | | /** |
| | | * åå
¸ ä¸å¡å±å¤ç |
| | |
| | | import com.se.system.api.domain.SysDictType; |
| | | import com.se.system.mapper.SysDictDataMapper; |
| | | import com.se.system.mapper.SysDictTypeMapper; |
| | | import com.se.system.service.ISysDictTypeService; |
| | | import com.se.system.service.inte.ISysDictTypeService; |
| | | |
| | | /** |
| | | * åå
¸ ä¸å¡å±å¤ç |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.api.domain.SysLogininfor; |
| | | import com.se.system.mapper.SysLogininforMapper; |
| | | import com.se.system.service.ISysLogininforService; |
| | | import com.se.system.service.inte.ISysLogininforService; |
| | | |
| | | /** |
| | | * ç³»ç»è®¿é®æ¥å¿æ
åµä¿¡æ¯ æå¡å±å¤ç |
| | |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.security.utils.SecurityUtils; |
| | | import com.se.system.api.domain.SysRole; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.domain.vo.*; |
| | | import com.se.system.mapper.SysMenuMapper; |
| | | import com.se.system.mapper.*; |
| | | import com.se.system.service.ISysMenuService; |
| | | import com.se.system.service.inte.ISysMenuService; |
| | | |
| | | /** |
| | | * èå ä¸å¡å±å¤ç |
| | |
| | | * @author admin |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class SysMenuServiceImpl implements ISysMenuService { |
| | | public static final String PREMISSION_STRING = "perms[\"{0}\"]"; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<SysMenu> selectMenuList(SysMenu menu, Long userId) { |
| | | List<SysMenu> menuList = null; |
| | | /*List<SysMenu> menuList = null; |
| | | // 管çåæ¾ç¤ºææèåä¿¡æ¯ |
| | | if (SysUser.isAdmin(userId)) { |
| | | menuList = menuMapper.selectMenuList(menu); |
| | | } else { |
| | | menu.getParams().put("userId", userId); |
| | | menuList = menuMapper.selectMenuListByUserId(menu); |
| | | } |
| | | return menuList; |
| | | }*/ |
| | | menu.setMenuId(SecurityUtils.isAdmin(userId) ? null : userId); |
| | | return menuMapper.selectMenuListByUserId(menu); |
| | | } |
| | | |
| | | /** |
| | |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢èå |
| | | * |
| | | * @param userId ç¨æ·åç§° |
| | | * @param mark æ è¯ |
| | | * @param mark èåæ è¯ |
| | | * @return èåå表 |
| | | */ |
| | | @Override |
| | |
| | | /** |
| | | * è·åè·¯ç±åç§°ï¼å¦æ²¡æé
置路ç±åç§°ååè·¯ç±å°å |
| | | * |
| | | * @param routerName è·¯ç±åç§° |
| | | * @param path è·¯ç±å°å |
| | | * @param name è·¯ç±åç§° |
| | | * @param path è·¯ç±å°å |
| | | * @return è·¯ç±åç§°ï¼é©¼å³°æ ¼å¼ï¼ |
| | | */ |
| | | public String getRouteName(String name, String path) { |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.mapper.SysNoticeMapper; |
| | | import com.se.system.service.ISysNoticeService; |
| | | import com.se.system.service.inte.ISysNoticeService; |
| | | |
| | | /** |
| | | * å
¬å æå¡å±å®ç° |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.system.api.domain.SysOperLog; |
| | | import com.se.system.mapper.SysOperLogMapper; |
| | | import com.se.system.service.ISysOperLogService; |
| | | import com.se.system.service.inte.ISysOperLogService; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ æå¡å±å¤ç |
| | |
| | | package com.se.system.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.system.domain.SysPost; |
| | | import com.se.system.mapper.SysPostMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.util.CollectionUtils; |
| | | import com.se.system.api.domain.SysRole; |
| | | import com.se.system.api.domain.SysUser; |
| | | import com.se.system.service.ISysMenuService; |
| | | import com.se.system.service.ISysPermissionService; |
| | | import com.se.system.service.ISysRoleService; |
| | | import com.se.system.service.inte.ISysMenuService; |
| | | import com.se.system.service.inte.ISysPermissionService; |
| | | import com.se.system.service.inte.ISysRoleService; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.system.mapper.SysPostMapper; |
| | | import com.se.system.mapper.SysUserPostMapper; |
| | | import com.se.system.service.ISysPostService; |
| | | import com.se.system.service.inte.ISysPostService; |
| | | |
| | | /** |
| | | * å²ä½ä¿¡æ¯ æå¡å±å¤ç |
| | |
| | | import com.se.system.mapper.SysRoleMapper; |
| | | import com.se.system.mapper.SysRoleMenuMapper; |
| | | import com.se.system.mapper.SysUserRoleMapper; |
| | | import com.se.system.service.ISysRoleService; |
| | | import com.se.system.service.inte.ISysRoleService; |
| | | |
| | | /** |
| | | * è§è² ä¸å¡å±å¤ç |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.service.ISysUserOnlineService; |
| | | import com.se.system.service.inte.ISysUserOnlineService; |
| | | |
| | | /** |
| | | * å¨çº¿ç¨æ· æå¡å±å¤ç |
| | |
| | | import com.se.system.mapper.SysUserMapper; |
| | | import com.se.system.mapper.SysUserPostMapper; |
| | | import com.se.system.mapper.SysUserRoleMapper; |
| | | import com.se.system.service.ISysConfigService; |
| | | import com.se.system.service.ISysDeptService; |
| | | import com.se.system.service.ISysUserService; |
| | | import com.se.system.service.inte.ISysConfigService; |
| | | import com.se.system.service.inte.ISysDeptService; |
| | | import com.se.system.service.inte.ISysUserService; |
| | | |
| | | /** |
| | | * ç¨æ· ä¸å¡å±å¤ç |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.*; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysDept; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysDictData; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysDictData; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.service.inte; |
| | | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ æ¥å£ |
| | | * |
| | | * @author admin |
| | | */ |
| | | public interface ISysFileService |
| | | { |
| | | /** |
| | | * æä»¶ä¸ä¼ æ¥å£ |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return 访é®å°å |
| | | * @throws Exception |
| | | */ |
| | | public String uploadFile(MultipartFile file) throws Exception; |
| | | } |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysLogininfor; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | |
| | | * æ ¹æ®ç¨æ·IDæ¥è¯¢èåæ ä¿¡æ¯ |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @param mark æ è¯ |
| | | * @param mark èåæ è¯ |
| | | * @return èåå表 |
| | | */ |
| | | public List<SysMenu> selectMenuTreeByUserId(Long userId, String mark); |
| | |
| | | * æ ¹æ®ç¨æ·IDåæ è¯æ¥è¯¢èå |
| | | * |
| | | * @param userId ç¨æ·ID |
| | | * @param mark æ è¯ |
| | | * @param mark èåæ è¯ |
| | | * @return èåéå |
| | | */ |
| | | List<SysMenu> selectMenusByUserIdAndMark(Long userId, String mark); |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysNotice; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysOperLog; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.domain.SysPost; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import com.se.system.api.model.LoginUser; |
| | | import com.se.system.domain.SysUserOnline; |
ÎļþÃû´Ó se-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java ÐÞ¸Ä |
| | |
| | | package com.se.system.service; |
| | | package com.se.system.service.inte; |
| | | |
| | | import java.util.List; |
| | | import com.se.system.api.domain.SysUser; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.se.system.utils; |
| | | |
| | | import com.se.common.core.exception.file.FileException; |
| | | import com.se.common.core.exception.file.FileNameLengthLimitExceededException; |
| | | import com.se.common.core.exception.file.FileSizeLimitExceededException; |
| | | import com.se.common.core.exception.file.InvalidExtensionException; |
| | | import com.se.common.core.utils.DateUtils; |
| | | import com.se.common.core.utils.StringUtils; |
| | | import com.se.common.core.utils.file.FileTypeUtils; |
| | | import com.se.common.core.utils.file.MimeTypeUtils; |
| | | import com.se.common.core.utils.uuid.Seq; |
| | | import org.apache.commons.io.FilenameUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.nio.file.Paths; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ å·¥å
·ç±» |
| | | * |
| | | * @author admin |
| | | */ |
| | | public class FileUploadUtils |
| | | { |
| | | /** |
| | | * é»è®¤å¤§å° 50M |
| | | */ |
| | | public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L; |
| | | |
| | | /** |
| | | * é»è®¤çæä»¶åæå¤§é¿åº¦ 100 |
| | | */ |
| | | public static final int DEFAULT_FILE_NAME_LENGTH = 100; |
| | | |
| | | /** |
| | | * æ ¹æ®æä»¶è·¯å¾ä¸ä¼ |
| | | * |
| | | * @param baseDir ç¸å¯¹åºç¨çåºç®å½ |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @return æä»¶åç§° |
| | | * @throws IOException |
| | | */ |
| | | public static final String upload(String baseDir, MultipartFile file) throws IOException |
| | | { |
| | | try |
| | | { |
| | | return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); |
| | | } |
| | | catch (FileException fe) |
| | | { |
| | | throw new IOException(fe.getDefaultMessage(), fe); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new IOException(e.getMessage(), e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æä»¶ä¸ä¼ |
| | | * |
| | | * @param baseDir ç¸å¯¹åºç¨çåºç®å½ |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @param allowedExtension ä¸ä¼ æä»¶ç±»å |
| | | * @return è¿åä¸ä¼ æåçæä»¶å |
| | | * @throws FileSizeLimitExceededException 妿è¶
åºæå¤§å¤§å° |
| | | * @throws FileNameLengthLimitExceededException æä»¶åå¤ªé¿ |
| | | * @throws IOException æ¯å¦è¯»åæä»¶åºéæ¶ |
| | | * @throws InvalidExtensionException æä»¶æ ¡éªå¼å¸¸ |
| | | */ |
| | | public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension) |
| | | throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException, |
| | | InvalidExtensionException |
| | | { |
| | | int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length(); |
| | | if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) |
| | | { |
| | | throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); |
| | | } |
| | | |
| | | assertAllowed(file, allowedExtension); |
| | | |
| | | String fileName = extractFilename(file); |
| | | |
| | | String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath(); |
| | | file.transferTo(Paths.get(absPath)); |
| | | return getPathFileName(fileName); |
| | | } |
| | | |
| | | /** |
| | | * ç¼ç æä»¶å |
| | | */ |
| | | public static final String extractFilename(MultipartFile file) |
| | | { |
| | | return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), |
| | | FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file)); |
| | | } |
| | | |
| | | private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException |
| | | { |
| | | File desc = new File(uploadDir + File.separator + fileName); |
| | | |
| | | if (!desc.exists()) |
| | | { |
| | | if (!desc.getParentFile().exists()) |
| | | { |
| | | desc.getParentFile().mkdirs(); |
| | | } |
| | | } |
| | | return desc.isAbsolute() ? desc : desc.getAbsoluteFile(); |
| | | } |
| | | |
| | | private static final String getPathFileName(String fileName) throws IOException |
| | | { |
| | | String pathFileName = "/" + fileName; |
| | | return pathFileName; |
| | | } |
| | | |
| | | /** |
| | | * æä»¶å¤§å°æ ¡éª |
| | | * |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @throws FileSizeLimitExceededException 妿è¶
åºæå¤§å¤§å° |
| | | * @throws InvalidExtensionException æä»¶æ ¡éªå¼å¸¸ |
| | | */ |
| | | public static final void assertAllowed(MultipartFile file, String[] allowedExtension) |
| | | throws FileSizeLimitExceededException, InvalidExtensionException |
| | | { |
| | | long size = file.getSize(); |
| | | if (size > DEFAULT_MAX_SIZE) |
| | | { |
| | | throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024); |
| | | } |
| | | |
| | | String fileName = file.getOriginalFilename(); |
| | | String extension = FileTypeUtils.getExtension(file); |
| | | if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) |
| | | { |
| | | if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION) |
| | | { |
| | | throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension, |
| | | fileName); |
| | | } |
| | | else |
| | | { |
| | | throw new InvalidExtensionException(allowedExtension, extension, fileName); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 夿MIMEç±»åæ¯å¦æ¯å
许çMIMEç±»å |
| | | * |
| | | * @param extension ä¸ä¼ æä»¶ç±»å |
| | | * @param allowedExtension å
许ä¸ä¼ æä»¶ç±»å |
| | | * @return true/false |
| | | */ |
| | | public static final boolean isAllowedExtension(String extension, String[] allowedExtension) |
| | | { |
| | | for (String str : allowedExtension) |
| | | { |
| | | if (str.equalsIgnoreCase(extension)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | } |
| | |
| | | </appender> |
| | | |
| | | <!-- ç³»ç»æ¨¡åæ¥å¿çº§å«æ§å¶:info,debug --> |
| | | <logger name="com.se" level="info" /> |
| | | <logger name="com.se" level="debug" /> |
| | | <!-- Springæ¥å¿çº§å«æ§å¶ --> |
| | | <logger name="org.springframework" level="warn" /> |
| | | |
| | |
| | | <select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult"> |
| | | select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.route_name, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time, m.mark |
| | | from sys_menu m |
| | | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| | | left join sys_user_role ur on rm.role_id = ur.role_id |
| | | left join sys_role ro on ur.role_id = ro.role_id |
| | | where ur.user_id = #{params.userId} |
| | | <if test="menuName != null and menuName != ''"> |
| | | AND m.menu_name like concat('%', #{menuName}, '%') |
| | | </if> |
| | | <if test="visible != null and visible != ''"> |
| | | AND m.visible = #{visible} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND m.status = #{status} |
| | | </if> |
| | | left join sys_role_menu rm on m.menu_id = rm.menu_id |
| | | left join sys_user_role ur on rm.role_id = ur.role_id |
| | | left join sys_role ro on ur.role_id = ro.role_id |
| | | <where> |
| | | <if test="menuId != null"> |
| | | ur.user_id = #{menuId} |
| | | </if> |
| | | <if test="menuName != null and menuName != ''"> |
| | | AND m.menu_name like concat('%', #{menuName}, '%') |
| | | </if> |
| | | <if test="visible != null and visible != ''"> |
| | | AND m.visible = #{visible} |
| | | </if> |
| | | <if test="status != null and status != ''"> |
| | | AND m.status = #{status} |
| | | </if> |
| | | <if test="mark != null and mark != ''"> |
| | | AND m.mark = #{mark} |
| | | </if> |
| | | </where> |
| | | order by m.parent_id, m.order_num |
| | | </select> |
| | | |
| | |
| | | left join sys_role ro on ur.role_id = ro.role_id |
| | | left join sys_user u on ur.user_id = u.user_id |
| | | where m.menu_type in ('M', 'C') and m.status = 0 and ro.status = 0 |
| | | <if test="userId != null and userId != ''"> |
| | | <if test="userId != null"> |
| | | and u.user_id = #{userId} |
| | | </if> |
| | | <if test="mark != null and mark != ''"> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | http://192.168.11.203:8090/sso/login |
| | | http://192.168.11.203:8848/nacosï¼nAcos_!9#_admIn |
| | | |
| | | |
| | | |
| | | docker-compose logs -f -n 50 se-system |
| | | |
| | | se-gateway-dev.ymlï¼ä¿®æ¹ |
| | | -------------------------------------------------------- |
| | | uri: lb://se-auth â uri: lb://se-system |
| | | |
| | | uri: lb://se-file â uri: lb://se-system |
| | | |
| | | -------------------------------------------------------- |
| | | |
| | | se-system-dev.ymlï¼æ·»å |
| | | -------------------------------------------------------- |
| | | # æ¬å°æä»¶ä¸ä¼ |
| | | file: |
| | | domain: http://127.0.0.1:9300 |
| | | path: D:/se/uploadPath |
| | | prefix: /statics |
| | | |
| | | # FastDFSé
ç½® |
| | | fdfs: |
| | | domain: http://8.129.231.12 |
| | | soTimeout: 3000 |
| | | connectTimeout: 2000 |
| | | trackerList: 8.129.231.12:22122 |
| | | |
| | | # Minioé
ç½® |
| | | minio: |
| | | url: http://8.129.231.12:9000 |
| | | accessKey: minioadmin |
| | | secretKey: minioadmin |
| | | bucketName: test |
| | | -------------------------------------------------------- |