Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-api-boot
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-api-boot
Commits
69ac9fed
提交
69ac9fed
authored
6月 22, 2022
作者:
方治民
浏览文件
操作
浏览文件
下载
差异文件
合并分支 'master' 到 'beta'
Master 查看合并请求 basic/basic-api-project!10
上级
b408b1ef
65d2f0c1
流水线
#186
已失败 于阶段
in 1 分 0 秒
变更
27
流水线
1
隐藏空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
594 行增加
和
95 行删除
+594
-95
build.gradle
app/build.gradle
+1
-1
package-info.java
...src/main/java/com/yiring/app/web/common/package-info.java
+4
-2
ExampleController.java
...in/java/com/yiring/app/web/example/ExampleController.java
+6
-1
package-info.java
app/src/main/java/com/yiring/app/web/package-info.java
+4
-2
application-dev-mysql.yml
app/src/main/resources/application-dev-mysql.yml
+0
-0
application-dev-postgresql.yml
app/src/main/resources/application-dev-postgresql.yml
+52
-0
application.yml
app/src/main/resources/application.yml
+1
-1
Permission.java
...in/java/com/yiring/auth/domain/permission/Permission.java
+2
-7
Role.java
...-auth/src/main/java/com/yiring/auth/domain/role/Role.java
+2
-2
User.java
...-auth/src/main/java/com/yiring/auth/domain/user/User.java
+8
-15
RegisterParam.java
...c/main/java/com/yiring/auth/param/auth/RegisterParam.java
+1
-1
PermissionController.java
.../com/yiring/auth/web/permission/PermissionController.java
+3
-0
init-test-mysql.sql
basic-auth/src/main/resources/init-test-mysql.sql
+4
-4
init-test-postgresql.sql
basic-auth/src/main/resources/init-test-postgresql.sql
+266
-0
build.gradle
basic-common/core/build.gradle
+2
-4
RequestAspect.java
...src/main/java/com/yiring/common/aspect/RequestAspect.java
+2
-1
IdsParam.java
.../core/src/main/java/com/yiring/common/param/IdsParam.java
+1
-1
SwaggerConfig.java
...rc/main/java/com/yiring/common/swagger/SwaggerConfig.java
+27
-5
Minio.java
...mon/minio/src/main/java/com/yiring/common/core/Minio.java
+1
-1
MinioController.java
.../src/main/java/com/yiring/common/web/MinioController.java
+4
-3
Redis.java
...mon/redis/src/main/java/com/yiring/common/core/Redis.java
+17
-0
build.gradle
basic-common/util/build.gradle
+1
-0
Times.java
...til/src/main/java/com/yiring/common/annotation/Times.java
+23
-0
TimesAspect.java
...l/src/main/java/com/yiring/common/aspect/TimesAspect.java
+68
-0
XxlJobAspect.java
.../src/main/java/com/yiring/common/aspect/XxlJobAspect.java
+37
-0
Commons.java
...on/util/src/main/java/com/yiring/common/util/Commons.java
+5
-0
build.gradle
build.gradle
+52
-44
没有找到文件。
app/build.gradle
浏览文件 @
69ac9fed
...
...
@@ -13,7 +13,7 @@ dependencies {
runtimeOnly
'com.h2database:h2'
// 💬 Prod/Dev Env
runtimeOnly
'mysql:mysql-connector-java'
//
runtimeOnly 'org.postgresql:postgresql'
runtimeOnly
'org.postgresql:postgresql'
// 本地依赖
implementation
fileTree
(
dir:
project
.
rootDir
.
getPath
()
+
'\\libs'
,
includes:
[
'*jar'
])
...
...
basic-auth/src/main/java/com/yiring/auth
/package-info.java
→
app/src/main/java/com/yiring/app/web/common
/package-info.java
浏览文件 @
69ac9fed
/**
* 公共接口
*
* @author Jim
* @version 0.1
* 2022/
3/23 16:18
* 2022/
6/22 11:30
*/
package
com
.
yiring
.
a
uth
;
package
com
.
yiring
.
a
pp
.
web
.
common
;
app/src/main/java/com/yiring/app/web/ExampleController.java
→
app/src/main/java/com/yiring/app/web/
example/
ExampleController.java
浏览文件 @
69ac9fed
/* (C) 2021 YiRing, Inc. */
package
com
.
yiring
.
app
.
web
;
package
com
.
yiring
.
app
.
web
.
example
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
...
...
@@ -26,6 +26,11 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* 示例接口
* @author Jim
*/
@Slf4j
@Validated
@SuppressWarnings
({
"deprecation"
})
...
...
basic-auth/src/main/java/com/yiring/auth
/web/package-info.java
→
app/src/main/java/com/yiring/app
/web/package-info.java
浏览文件 @
69ac9fed
/**
* Controller
*
* @author Jim
* @version 0.1
* 2022/
3/24 16:37
* 2022/
6/22 11:29
*/
package
com
.
yiring
.
a
uth
.
web
;
package
com
.
yiring
.
a
pp
.
web
;
app/src/main/resources/application-dev.yml
→
app/src/main/resources/application-dev
-mysql
.yml
浏览文件 @
69ac9fed
File moved
app/src/main/resources/application-dev-postgresql.yml
0 → 100644
浏览文件 @
69ac9fed
# 环境变量
env
:
host
:
192.168.0.156
spring
:
datasource
:
url
:
jdbc:postgresql://${env.host}:5432/basic_app
username
:
admin
password
:
123456
jpa
:
database-platform
:
org.hibernate.dialect.PostgreSQL10Dialect
open-in-view
:
true
hibernate
:
ddl-auto
:
update
show-sql
:
true
properties
:
hibernate
:
format_sql
:
true
redis
:
database
:
5
host
:
${env.host}
port
:
6379
password
:
123456
# Optional: MyBatis Plus
mybatis-plus
:
global-config
:
banner
:
false
# knife4j
knife4j
:
enable
:
true
basic
:
enable
:
false
username
:
admin
password
:
123456
setting
:
enableOpenApi
:
true
enableDebug
:
true
# minio
minio
:
access-key
:
minioadmin
secret-key
:
minioadmin
end-point
:
"
http://${env.host}:18100"
bucket
:
basic
domain
:
${minio.endpoint}/${minio.bucket}
logging
:
level
:
# sql bind parameter
org.hibernate.type.descriptor.sql.BasicBinder
:
trace
app/src/main/resources/application.yml
浏览文件 @
69ac9fed
...
...
@@ -13,7 +13,7 @@ spring:
name
:
"
basic-api-app"
profiles
:
include
:
auth, conf-patch
active
:
beta
active
:
dev-postgresql
# DEBUG
debug
:
false
basic-auth/src/main/java/com/yiring/auth/domain/permission/Permission.java
浏览文件 @
69ac9fed
...
...
@@ -23,7 +23,7 @@ import org.hibernate.annotations.TypeDef;
@Getter
@Setter
@
ToString
@
EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@AllArgsConstructor
...
...
@@ -33,12 +33,7 @@ import org.hibernate.annotations.TypeDef;
@TypeDef
(
name
=
"json"
,
typeClass
=
JsonType
.
class
)
@Table
(
name
=
"SYS_PERMISSION"
,
indexes
=
{
@Index
(
columnList
=
"type"
),
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
),
@Index
(
columnList
=
"uid"
,
unique
=
true
),
}
indexes
=
{
@Index
(
columnList
=
"type"
),
@Index
(
columnList
=
"pid"
),
@Index
(
columnList
=
"tree"
)
}
)
@Comment
(
"系统权限"
)
public
class
Permission
extends
BasicEntity
implements
Serializable
{
...
...
basic-auth/src/main/java/com/yiring/auth/domain/role/Role.java
浏览文件 @
69ac9fed
...
...
@@ -25,7 +25,7 @@ import org.hibernate.annotations.Comment;
@Getter
@Setter
@
ToString
@
EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@AllArgsConstructor
...
...
@@ -40,7 +40,7 @@ public class Role extends BasicEntity implements Serializable {
private
static
final
long
serialVersionUID
=
910404402503275957L
;
@Comment
(
"标识"
)
@Column
(
unique
=
true
,
nullable
=
false
)
@Column
(
nullable
=
false
)
String
uid
;
@Comment
(
"名称"
)
...
...
basic-auth/src/main/java/com/yiring/auth/domain/user/User.java
浏览文件 @
69ac9fed
...
...
@@ -15,6 +15,7 @@ import lombok.experimental.FieldDefaults;
import
lombok.experimental.FieldNameConstants
;
import
lombok.experimental.SuperBuilder
;
import
org.hibernate.annotations.Comment
;
import
org.hibernate.annotations.Where
;
/**
* 用户
...
...
@@ -25,23 +26,15 @@ import org.hibernate.annotations.Comment;
@Getter
@Setter
@
ToString
@
EqualsAndHashCode
(
callSuper
=
false
)
@SuperBuilder
(
toBuilder
=
true
)
@NoArgsConstructor
@AllArgsConstructor
@FieldNameConstants
@FieldDefaults
(
level
=
AccessLevel
.
PRIVATE
)
@Where
(
clause
=
"deleted = false"
)
@Entity
@Table
(
name
=
"SYS_USER"
,
indexes
=
{
@Index
(
columnList
=
"mobile"
,
unique
=
true
),
@Index
(
columnList
=
"username"
,
unique
=
true
),
@Index
(
columnList
=
"email"
,
unique
=
true
),
@Index
(
columnList
=
"enabled"
),
@Index
(
columnList
=
"deleted"
),
}
)
@Table
(
name
=
"SYS_USER"
,
indexes
=
{
@Index
(
columnList
=
"enabled"
),
@Index
(
columnList
=
"deleted"
)
})
@Comment
(
"系统用户"
)
public
class
User
extends
BasicEntity
implements
Serializable
{
...
...
@@ -81,13 +74,13 @@ public class User extends BasicEntity implements Serializable {
@JsonIgnore
@Builder
.
Default
@Comment
(
"角色集合"
)
@ManyToMany
(
fetch
=
FetchType
.
EAGER
)
@ManyToMany
@JoinTable
(
name
=
"SYS_USER_ROLES"
,
joinColumns
=
{
@JoinColumn
(
name
=
"user_id"
)
}
,
inverseJoinColumns
=
{
@JoinColumn
(
name
=
"role_id"
)
}
joinColumns
=
@JoinColumn
(
name
=
"user_id"
)
,
inverseJoinColumns
=
@JoinColumn
(
name
=
"role_id"
)
)
Set
<
Role
>
roles
=
new
HashSet
<>();
Set
<
Role
>
roles
=
new
HashSet
<>(
0
);
@Comment
(
"最后登录IP地址"
)
String
lastLoginIp
;
...
...
basic-auth/src/main/java/com/yiring/auth/param/auth/RegisterParam.java
浏览文件 @
69ac9fed
...
...
@@ -42,7 +42,7 @@ public class RegisterParam implements Serializable {
@ApiModelProperty
(
value
=
"手机号"
,
example
=
"13012345678"
,
required
=
true
)
@NotEmpty
(
message
=
"手机号不能为空"
)
@Pattern
(
regexp
=
"^1
[0-9]
{10}$"
,
message
=
"手机号码格式不正确"
)
@Pattern
(
regexp
=
"^1
\\d
{10}$"
,
message
=
"手机号码格式不正确"
)
String
mobile
;
@ApiModelProperty
(
value
=
"头像"
,
example
=
"https://s1.ax1x.com/2022/03/30/qggJH0.jpg"
)
...
...
basic-auth/src/main/java/com/yiring/auth/web/permission/PermissionController.java
浏览文件 @
69ac9fed
...
...
@@ -2,6 +2,7 @@
package
com
.
yiring
.
auth
.
web
.
permission
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.yiring.auth.domain.permission.Permission
;
import
com.yiring.auth.domain.permission.PermissionRepository
;
...
...
@@ -61,6 +62,7 @@ public class PermissionController {
Permission
entity
=
new
Permission
();
BeanUtils
.
copyProperties
(
param
,
entity
);
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setMeta
(
JSON
.
parseObject
(
param
.
getMeta
()));
permissionRepository
.
saveAndFlush
(
entity
);
return
Result
.
ok
();
}
...
...
@@ -83,6 +85,7 @@ public class PermissionController {
BeanUtils
.
copyProperties
(
param
,
entity
);
entity
.
setTree
(
getTreeNode
(
param
.
getPid
()));
entity
.
setMeta
(
JSON
.
parseObject
(
param
.
getMeta
()));
permissionRepository
.
saveAndFlush
(
entity
);
return
Result
.
ok
();
}
...
...
basic-auth/src/main/resources/init-test-mysql.sql
浏览文件 @
69ac9fed
...
...
@@ -49,10 +49,10 @@ CREATE TABLE `sys_permission` (
-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT
INTO
`sys_permission`
VALUES
(
'1515550180340928512'
,
'2022-04-17 12:38:15.212000'
,
'2022-04-17 12:38:15.212000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'ion:grid-outline'
,
'{
\"
title
\"
:
\"
routes.dashboard.dashboard
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'Dashboard'
,
'/dashboard'
,
0
,
'/dashboard/workbench'
,
1
,
'0'
,
'MENU'
,
'Dashboard'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627442394370048'
,
'2022-04-17 17:45:15.941000'
,
'2022-04-17 17:45:15.941000'
,
'/dashboard/workbench/index'
,
b
'1'
,
b
'1'
,
NULL
,
'{
\"
title
\"
:
\"
routes.dashboard.workbench
\"
,
\"
hideBreadcrumb
\"
: true,
\"
currentActiveMenu
\"
:
\"
/dashboard
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'Workbench'
,
'workbench'
,
'1515550180340928512'
,
NULL
,
1
,
'0.1515550180340928512'
,
'MENU'
,
'Workbench'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627944716800000'
,
'2022-04-17 17:47:15.683000'
,
'2022-04-17 17:47:15.683000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
\"
title
\"
:
\"
routes.dashboard.about
\"
,
\"
hideChildrenInMenu
\
"
: true}'
,
'About'
,
'/about'
,
0
,
'/about/index'
,
100000
,
'0'
,
'MENU'
,
'About'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515628470086930432'
,
'2022-04-17 17:49:20.941000'
,
'2022-04-17 17:49:20.942000'
,
'/sys/about/index'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
\"
title
\"
:
\"
routes.dashboard.about
\"
,
\"
hideMenu
\
"
: true}'
,
'AboutPage'
,
'index'
,
'1515627944716800000'
,
NULL
,
NULL
,
'0.1515627944716800000'
,
'MENU'
,
'AboutPage'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515550180340928512'
,
'2022-04-17 12:38:15.212000'
,
'2022-04-17 12:38:15.212000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'ion:grid-outline'
,
'{
"title": "routes.dashboard.dashboard", "hideChildrenInMenu
": true}'
,
'Dashboard'
,
'/dashboard'
,
0
,
'/dashboard/workbench'
,
1
,
'0'
,
'MENU'
,
'Dashboard'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627442394370048'
,
'2022-04-17 17:45:15.941000'
,
'2022-04-17 17:45:15.941000'
,
'/dashboard/workbench/index'
,
b
'1'
,
b
'1'
,
NULL
,
'{
"title": "routes.dashboard.workbench", "hideBreadcrumb": true, "currentActiveMenu": "/dashboard", "hideChildrenInMenu
": true}'
,
'Workbench'
,
'workbench'
,
'1515550180340928512'
,
NULL
,
1
,
'0.1515550180340928512'
,
'MENU'
,
'Workbench'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515627944716800000'
,
'2022-04-17 17:47:15.683000'
,
'2022-04-17 17:47:15.683000'
,
'LAYOUT'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
"title": "routes.dashboard.about", "hideChildrenInMenu
": true}'
,
'About'
,
'/about'
,
0
,
'/about/index'
,
100000
,
'0'
,
'MENU'
,
'About'
);
INSERT
INTO
`sys_permission`
VALUES
(
'1515628470086930432'
,
'2022-04-17 17:49:20.941000'
,
'2022-04-17 17:49:20.942000'
,
'/sys/about/index'
,
b
'1'
,
NULL
,
'simple-icons:about-dot-me'
,
'{
"title": "routes.dashboard.about", "hideMenu
": true}'
,
'AboutPage'
,
'index'
,
'1515627944716800000'
,
NULL
,
NULL
,
'0.1515627944716800000'
,
'MENU'
,
'AboutPage'
);
-- ----------------------------
-- Table structure for sys_role
...
...
basic-auth/src/main/resources/init-test-postgresql.sql
0 → 100644
浏览文件 @
69ac9fed
/*
Navicat Premium Data Transfer
Source Server : 192.168.0.156_5432
Source Server Type : PostgreSQL
Source Server Version : 130003
Source Host : 192.168.0.156:5432
Source Catalog : basic_app
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 130003
File Encoding : 65001
Date: 27/05/2022 14:09:18
*/
-- ----------------------------
-- Table structure for sys_permission
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"sys_permission"
;
CREATE
TABLE
"public"
.
"sys_permission"
(
"id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"create_time"
timestamp
(
6
)
NOT
NULL
,
"update_time"
timestamp
(
6
)
NOT
NULL
,
"component"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"enable"
bool
,
"hidden"
bool
,
"icon"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"meta"
json
,
"name"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"path"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"pid"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"redirect"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"serial"
int4
,
"tree"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"type"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"uid"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
)
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"id"
IS
'主键'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"create_time"
IS
'创建时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"update_time"
IS
'最后修改时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"component"
IS
'组件'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"enable"
IS
'是否启用'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"hidden"
IS
'是否隐藏'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"icon"
IS
'图标'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"meta"
IS
'扩展元数据信息'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"name"
IS
'名称'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"path"
IS
'路径'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"pid"
IS
'权限父级ID'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"redirect"
IS
'重定向'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"serial"
IS
'序号'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"tree"
IS
'树节点标识'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"type"
IS
'类型(MENU: 菜单, BUTTON: 按钮)'
;
COMMENT
ON
COLUMN
"public"
.
"sys_permission"
.
"uid"
IS
'标识'
;
COMMENT
ON
TABLE
"public"
.
"sys_permission"
IS
'系统权限'
;
-- ----------------------------
-- Records of sys_permission
-- ----------------------------
INSERT
INTO
"public"
.
"sys_permission"
VALUES
(
'1515627442394370048'
,
'2022-04-17 17:45:15.941'
,
'2022-05-17 18:48:22.001'
,
'/dashboard/workbench/index'
,
't'
,
't'
,
NULL
,
'{"title": "routes.dashboard.workbench", "hideBreadcrumb": true, "currentActiveMenu": "/dashboard", "hideChildrenInMenu": true}'
,
'Workbenchdddd'
,
'workbench'
,
'1515550180340928512'
,
NULL
,
1
,
'0.1515550180340928512'
,
'BUTTON'
,
'Workbench'
);
INSERT
INTO
"public"
.
"sys_permission"
VALUES
(
'1515627944716800000'
,
'2022-04-17 17:47:15.683'
,
'2022-05-25 16:18:06.724'
,
'LAYOUT'
,
't'
,
NULL
,
'simple-icons:about-dot-me'
,
'{"title": "routes.dashboard.about", "hideChildrenInMenu": true}'
,
'About'
,
'/about'
,
'0'
,
NULL
,
100000
,
'0'
,
'MENU'
,
'About'
);
INSERT
INTO
"public"
.
"sys_permission"
VALUES
(
'1515628470086930432'
,
'2022-04-17 17:49:20.941'
,
'2022-05-17 18:02:15.969'
,
'/sys/about/index'
,
'f'
,
't'
,
'simple-icons:about-dot-me'
,
'{"title": "routes.dashboard.about", "hideMenu": true}'
,
'AboutPage'
,
'index'
,
'1515627944716800000'
,
NULL
,
NULL
,
'0.1515627944716800000'
,
'BUTTON'
,
'AboutPage'
);
INSERT
INTO
"public"
.
"sys_permission"
VALUES
(
'1515550180340928512'
,
'2022-04-17 12:38:15.212'
,
'2022-05-24 17:50:13.742'
,
'LAYOUT'
,
't'
,
't'
,
'ion:grid-outline'
,
'{"title": "routes.dashboard.dashboard", "hideChildrenInMenu": true}'
,
'Dashboard'
,
'/dashboard'
,
'0'
,
'/dashboard/workbench'
,
1
,
'0'
,
'MENU'
,
'Dashboard'
);
-- ----------------------------
-- Table structure for sys_role
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"sys_role"
;
CREATE
TABLE
"public"
.
"sys_role"
(
"id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"create_time"
timestamp
(
6
)
NOT
NULL
,
"update_time"
timestamp
(
6
)
NOT
NULL
,
"name"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"uid"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
)
;
COMMENT
ON
COLUMN
"public"
.
"sys_role"
.
"id"
IS
'主键'
;
COMMENT
ON
COLUMN
"public"
.
"sys_role"
.
"create_time"
IS
'创建时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_role"
.
"update_time"
IS
'最后修改时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_role"
.
"name"
IS
'名称'
;
COMMENT
ON
COLUMN
"public"
.
"sys_role"
.
"uid"
IS
'标识'
;
COMMENT
ON
TABLE
"public"
.
"sys_role"
IS
'系统角色'
;
-- ----------------------------
-- Records of sys_role
-- ----------------------------
INSERT
INTO
"public"
.
"sys_role"
VALUES
(
'1530064847847297024'
,
'2022-05-27 13:54:21.623'
,
'2022-05-27 13:54:21.624'
,
'管理员'
,
'admin'
);
-- ----------------------------
-- Table structure for sys_role_permissions
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"sys_role_permissions"
;
CREATE
TABLE
"public"
.
"sys_role_permissions"
(
"role_id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"permissions_id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
)
;
-- ----------------------------
-- Records of sys_role_permissions
-- ----------------------------
INSERT
INTO
"public"
.
"sys_role_permissions"
VALUES
(
'1530064847847297024'
,
'1515627442394370048'
);
INSERT
INTO
"public"
.
"sys_role_permissions"
VALUES
(
'1530064847847297024'
,
'1515627944716800000'
);
INSERT
INTO
"public"
.
"sys_role_permissions"
VALUES
(
'1530064847847297024'
,
'1515628470086930432'
);
INSERT
INTO
"public"
.
"sys_role_permissions"
VALUES
(
'1530064847847297024'
,
'1515550180340928512'
);
-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"sys_user"
;
CREATE
TABLE
"public"
.
"sys_user"
(
"id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"create_time"
timestamp
(
6
)
NOT
NULL
,
"update_time"
timestamp
(
6
)
NOT
NULL
,
"avatar"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"deleted"
bool
,
"email"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"enabled"
bool
,
"introduction"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"last_login_ip"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"last_login_time"
timestamp
(
6
),
"mobile"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"password"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"real_name"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
,
"username"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
)
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"id"
IS
'主键'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"create_time"
IS
'创建时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"update_time"
IS
'最后修改时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"avatar"
IS
'头像'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"deleted"
IS
'是否删除'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"email"
IS
'邮箱'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"enabled"
IS
'是否启用'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"introduction"
IS
'简介'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"last_login_ip"
IS
'最后登录IP地址'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"last_login_time"
IS
'最后登录时间'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"mobile"
IS
'手机号'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"password"
IS
'密码'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"real_name"
IS
'真实姓名'
;
COMMENT
ON
COLUMN
"public"
.
"sys_user"
.
"username"
IS
'用户名'
;
COMMENT
ON
TABLE
"public"
.
"sys_user"
IS
'系统用户'
;
-- ----------------------------
-- Records of sys_user
-- ----------------------------
INSERT
INTO
"public"
.
"sys_user"
VALUES
(
'1530062713596678144'
,
'2022-05-27 13:45:52.805'
,
'2022-05-27 13:45:57.318'
,
'https://s1.ax1x.com/2022/03/30/qggJH0.jpg'
,
'f'
,
NULL
,
't'
,
'平台管理员'
,
'127.0.0.1'
,
'2022-05-27 13:45:57.309'
,
'13012345678'
,
'8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
,
'管理员'
,
'admin'
);
-- ----------------------------
-- Table structure for sys_user_roles
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"sys_user_roles"
;
CREATE
TABLE
"public"
.
"sys_user_roles"
(
"role_id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"user_id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
)
;
-- ----------------------------
-- Records of sys_user_roles
-- ----------------------------
INSERT
INTO
"public"
.
"sys_user_roles"
VALUES
(
'1530064847847297024'
,
'1530062713596678144'
);
-- ----------------------------
-- Table structure for test_table
-- ----------------------------
DROP
TABLE
IF
EXISTS
"public"
.
"test_table"
;
CREATE
TABLE
"public"
.
"test_table"
(
"id"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
NOT
NULL
,
"age"
int4
,
"name"
varchar
(
255
)
COLLATE
"pg_catalog"
.
"default"
)
;
COMMENT
ON
COLUMN
"public"
.
"test_table"
.
"id"
IS
'主键'
;
COMMENT
ON
COLUMN
"public"
.
"test_table"
.
"age"
IS
'年龄'
;
COMMENT
ON
COLUMN
"public"
.
"test_table"
.
"name"
IS
'姓名'
;
COMMENT
ON
TABLE
"public"
.
"test_table"
IS
'测试表'
;
-- ----------------------------
-- Records of test_table
-- ----------------------------
-- ----------------------------
-- Indexes structure for table sys_permission
-- ----------------------------
CREATE
INDEX
"idxcj5qpen847f3vkcgy7lsmqyug"
ON
"public"
.
"sys_permission"
USING
btree
(
"pid"
COLLATE
"pg_catalog"
.
"default"
"pg_catalog"
.
"text_ops"
ASC
NULLS
LAST
);
CREATE
INDEX
"idxckpwmqmt2tsu8fyefxpgwypmr"
ON
"public"
.
"sys_permission"
USING
btree
(
"tree"
COLLATE
"pg_catalog"
.
"default"
"pg_catalog"
.
"text_ops"
ASC
NULLS
LAST
);
CREATE
INDEX
"idxfgtwjg4pmylcko0v6ate29j2x"
ON
"public"
.
"sys_permission"
USING
btree
(
"type"
COLLATE
"pg_catalog"
.
"default"
"pg_catalog"
.
"text_ops"
ASC
NULLS
LAST
);
-- ----------------------------
-- Uniques structure for table sys_permission
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_permission"
ADD
CONSTRAINT
"uk_n5idwm5pmlgfwvau5vrwf65ai"
UNIQUE
(
"uid"
);
-- ----------------------------
-- Primary Key structure for table sys_permission
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_permission"
ADD
CONSTRAINT
"sys_permission_pkey"
PRIMARY
KEY
(
"id"
);
-- ----------------------------
-- Uniques structure for table sys_role
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_role"
ADD
CONSTRAINT
"uko928jdlxprqf5qyw6rvor4lse"
UNIQUE
(
"uid"
);
-- ----------------------------
-- Primary Key structure for table sys_role
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_role"
ADD
CONSTRAINT
"sys_role_pkey"
PRIMARY
KEY
(
"id"
);
-- ----------------------------
-- Primary Key structure for table sys_role_permissions
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_role_permissions"
ADD
CONSTRAINT
"sys_role_permissions_pkey"
PRIMARY
KEY
(
"role_id"
,
"permissions_id"
);
-- ----------------------------
-- Indexes structure for table sys_user
-- ----------------------------
CREATE
INDEX
"idxeyi36w6acltgl5j4ujw0wlsyt"
ON
"public"
.
"sys_user"
USING
btree
(
"enabled"
"pg_catalog"
.
"bool_ops"
ASC
NULLS
LAST
);
CREATE
INDEX
"idxner7sjf2kjerehlptwipdlst9"
ON
"public"
.
"sys_user"
USING
btree
(
"deleted"
"pg_catalog"
.
"bool_ops"
ASC
NULLS
LAST
);
-- ----------------------------
-- Uniques structure for table sys_user
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_user"
ADD
CONSTRAINT
"uk_ahtq5ew3v0kt1n7hf1sgp7p8l"
UNIQUE
(
"email"
);
ALTER
TABLE
"public"
.
"sys_user"
ADD
CONSTRAINT
"uk_cvv4commjv5h4bai0h4vuqvkd"
UNIQUE
(
"mobile"
);
ALTER
TABLE
"public"
.
"sys_user"
ADD
CONSTRAINT
"uk_51bvuyvihefoh4kp5syh2jpi4"
UNIQUE
(
"username"
);
-- ----------------------------
-- Primary Key structure for table sys_user
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_user"
ADD
CONSTRAINT
"sys_user_pkey"
PRIMARY
KEY
(
"id"
);
-- ----------------------------
-- Primary Key structure for table sys_user_roles
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_user_roles"
ADD
CONSTRAINT
"sys_user_roles_pkey"
PRIMARY
KEY
(
"role_id"
,
"user_id"
);
-- ----------------------------
-- Primary Key structure for table test_table
-- ----------------------------
ALTER
TABLE
"public"
.
"test_table"
ADD
CONSTRAINT
"test_table_pkey"
PRIMARY
KEY
(
"id"
);
-- ----------------------------
-- Foreign Keys structure for table sys_role_permissions
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_role_permissions"
ADD
CONSTRAINT
"fkaa4k4qhr2qdj6br8p5nrb2lhb"
FOREIGN
KEY
(
"role_id"
)
REFERENCES
"public"
.
"sys_role"
(
"id"
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
;
ALTER
TABLE
"public"
.
"sys_role_permissions"
ADD
CONSTRAINT
"fkrg8k5oymm622ik067yjss31co"
FOREIGN
KEY
(
"permissions_id"
)
REFERENCES
"public"
.
"sys_permission"
(
"id"
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
;
-- ----------------------------
-- Foreign Keys structure for table sys_user_roles
-- ----------------------------
ALTER
TABLE
"public"
.
"sys_user_roles"
ADD
CONSTRAINT
"fkp2804vh0ea810pitigxq5n6pn"
FOREIGN
KEY
(
"user_id"
)
REFERENCES
"public"
.
"sys_user"
(
"id"
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
;
ALTER
TABLE
"public"
.
"sys_user_roles"
ADD
CONSTRAINT
"fkqwiuml6b7mjmk48u5b9hmk853"
FOREIGN
KEY
(
"role_id"
)
REFERENCES
"public"
.
"sys_role"
(
"id"
)
ON
DELETE
NO
ACTION
ON
UPDATE
NO
ACTION
;
basic-common/core/build.gradle
浏览文件 @
69ac9fed
...
...
@@ -23,10 +23,8 @@ dependencies {
// https://mvnrepository.com/artifact/org.n52.jackson/jackson-datatype-jts/1.2.10
implementation
(
"org.n52.jackson:jackson-datatype-jts:1.2.10"
)
{
exclude
group:
'com.fasterxml.jackson.core'
,
module:
'jackson-databind'
exclude
group:
'com.fasterxml.jackson.core'
,
module:
'jackson-annotations'
exclude
group:
'com.fasterxml.jackson.core'
,
module:
'jackson-core'
exclude
group:
'org.locationtech.jts'
,
module:
'jts-core'
exclude
group:
'com.fasterxml.jackson.core'
exclude
group:
'org.locationtech.jts'
}
}
basic-common/core/src/main/java/com/yiring/common/aspect/RequestAspect.java
浏览文件 @
69ac9fed
...
...
@@ -35,7 +35,7 @@ public class RequestAspect {
Boolean
debug
;
@Pointcut
(
"@annotation(org.springframework.web.bind.annotation.PostMapping) || @annotation(org.springframework.web.bind.annotation.GetMapping) || @annotation(org.springframework.web.bind.annotation.PutMapping) || @annotation(org.springframework.web.bind.annotation.DeleteMapping) || @annotation(org.springframework.web.bind.annotation.PatchMapping) || @annotation(org.springframework.web.bind.annotation.ExceptionHandler)"
"@annotation(org.springframework.web.bind.annotation.
RequestMapping) || @annotation(org.springframework.web.bind.annotation.
PostMapping) || @annotation(org.springframework.web.bind.annotation.GetMapping) || @annotation(org.springframework.web.bind.annotation.PutMapping) || @annotation(org.springframework.web.bind.annotation.DeleteMapping) || @annotation(org.springframework.web.bind.annotation.PatchMapping) || @annotation(org.springframework.web.bind.annotation.ExceptionHandler)"
)
public
void
apiPointCut
()
{}
...
...
@@ -43,6 +43,7 @@ public class RequestAspect {
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
getRequest
();
// 计算接口执行耗时
long
start
=
System
.
currentTimeMillis
();
Object
result
=
point
.
proceed
();
long
end
=
System
.
currentTimeMillis
();
...
...
basic-common/core/src/main/java/com/yiring/common/param/IdsParam.java
浏览文件 @
69ac9fed
...
...
@@ -37,7 +37,7 @@ public class IdsParam implements Serializable {
String
ids
;
/**
* 获取
Lo
ng 类型的 ID 集合
* 获取
Stri
ng 类型的 ID 集合
* @return ID 集合
*/
public
Set
<
String
>
toIds
()
{
...
...
basic-common/doc/src/main/java/com/yiring/common/swagger/SwaggerConfig.java
浏览文件 @
69ac9fed
...
...
@@ -20,6 +20,7 @@ import org.springframework.context.annotation.Import;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration
;
import
springfox.documentation.RequestHandler
;
import
springfox.documentation.builders.ApiInfoBuilder
;
import
springfox.documentation.builders.PathSelectors
;
import
springfox.documentation.builders.RequestHandlerSelectors
;
...
...
@@ -58,13 +59,34 @@ public class SwaggerConfig implements CommandLineRunner {
@Resource
OpenApiExtensionResolver
openApiExtensionResolver
;
@Bean
@Bean
(
name
=
"api.default"
)
public
Docket
api
()
{
return
api
(
PathSelectors
.
any
());
return
api
(
"@default"
,
List
.
of
(
""
),
PathSelectors
.
any
());
}
private
Docket
api
(
Predicate
<
String
>
paths
)
{
String
group
=
"default"
;
@Bean
(
name
=
"api.auth"
)
public
Docket
auth
()
{
return
api
(
"Auth"
,
List
.
of
(
"com.yiring.auth.web.auth"
),
PathSelectors
.
any
());
}
@Bean
(
name
=
"api.common"
)
public
Docket
common
()
{
return
api
(
"公共"
,
List
.
of
(
"com.yiring.common.web"
,
"com.yiring.app.web.common"
),
PathSelectors
.
any
());
}
@Bean
(
name
=
"api.example"
)
public
Docket
example
()
{
return
api
(
"示例"
,
List
.
of
(
"com.yiring.app.web.example"
),
PathSelectors
.
any
());
}
private
Docket
api
(
String
group
,
List
<
String
>
basePackages
,
Predicate
<
String
>
paths
)
{
// 扫描多个包
Predicate
<
RequestHandler
>
predicate
=
basePackages
.
stream
()
.
map
(
RequestHandlerSelectors:
:
basePackage
)
.
reduce
(
Predicate:
:
or
)
.
orElse
(
RequestHandlerSelectors
.
none
());
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
groupName
(
group
)
.
apiInfo
(
apiInfo
())
...
...
@@ -74,7 +96,7 @@ public class SwaggerConfig implements CommandLineRunner {
.
globalResponseMessage
(
RequestMethod
.
DELETE
,
buildGlobalResponseMessage
())
.
globalResponseMessage
(
RequestMethod
.
PUT
,
buildGlobalResponseMessage
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
withClassAnnotation
(
Api
.
class
))
.
apis
(
RequestHandlerSelectors
.
withClassAnnotation
(
Api
.
class
)
.
and
(
predicate
)
)
.
paths
(
paths
)
.
build
()
.
extensions
(
openApiExtensionResolver
.
buildExtensions
(
group
));
...
...
basic-common/minio/src/main/java/com/yiring/common/core/Minio.java
浏览文件 @
69ac9fed
...
...
@@ -167,7 +167,7 @@ public record Minio(MinioConfig config, MinioClient client) {
public
ObjectWriteResponse
putBusinessObject
(
Path
path
,
String
object
)
throws
Exception
{
UploadObjectArgs
args
=
UploadObjectArgs
.
builder
()
// 固定
的
储存桶位置
// 固定
地
储存桶位置
.
bucket
(
BUSINESS_BUCKET
)
.
filename
(
path
.
toString
())
.
object
(
object
)
...
...
basic-common/minio/src/main/java/com/yiring/common/web/MinioController.java
浏览文件 @
69ac9fed
...
...
@@ -13,7 +13,7 @@ import io.swagger.annotations.ApiOperation;
import
io.swagger.annotations.ApiParam
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
javax.annotation.Resource
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
...
...
@@ -26,6 +26,7 @@ import org.springframework.web.multipart.MultipartFile;
/**
* Minio S3
* @author Jim
*/
@Slf4j
...
...
@@ -33,12 +34,12 @@ import org.springframework.web.multipart.MultipartFile;
@SuppressWarnings
({
"deprecation"
})
@ApiSupport
(
order
=
-
98
)
@Api
(
tags
=
"文件管理"
,
description
=
"file"
)
@RequiredArgsConstructor
@RestController
@RequestMapping
(
"/common/file/"
)
public
class
MinioController
{
@Resource
Minio
minio
;
final
Minio
minio
;
/**
* minio 上传文件,成功返回文件 url
...
...
basic-common/redis/src/main/java/com/yiring/common/core/Redis.java
浏览文件 @
69ac9fed
...
...
@@ -84,6 +84,23 @@ public final class Redis {
* 普通缓存获取
*
* @param key 键
* @param type 类型
* @return 值
*/
@SuppressWarnings
(
"unchecked"
)
public
<
T
>
T
get
(
String
key
,
Class
<
T
>
type
)
{
if
(
key
==
null
)
{
return
null
;
}
Object
value
=
redisTemplate
.
opsForValue
().
get
(
key
);
return
(
T
)
value
;
}
/**
* 普通缓存获取
*
* @param key 键
* @return 值
*/
public
String
getString
(
String
key
)
{
...
...
basic-common/util/build.gradle
浏览文件 @
69ac9fed
dependencies
{
implementation
'org.springframework.boot:spring-boot-starter-web'
implementation
'org.springframework.boot:spring-boot-starter-aop'
// hutool
implementation
"cn.hutool:hutool-core:${hutoolVersion}"
...
...
basic-common/util/src/main/java/com/yiring/common/annotation/Times.java
0 → 100644
浏览文件 @
69ac9fed
/* (C) 2022 YiRing, Inc. */
package
com
.
yiring
.
common
.
annotation
;
import
java.lang.annotation.*
;
/**
* 耗时计算注解
*
* @author Jim
* @version 0.1
* 2022/4/7 15:21
*/
@SuppressWarnings
({
"unused"
})
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
Times
{
/**
* 描述
*/
String
value
()
default
""
;
}
basic-common/util/src/main/java/com/yiring/common/aspect/TimesAspect.java
0 → 100644
浏览文件 @
69ac9fed
/* (C) 2021 YiRing, Inc. */
package
com
.
yiring
.
common
.
aspect
;
import
cn.hutool.core.util.StrUtil
;
import
com.yiring.common.annotation.Times
;
import
java.lang.reflect.Method
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.stereotype.Component
;
/**
* 耗时计算注解切面
*
* @author ifzm
* @version 0.1
*/
@Slf4j
@Aspect
@Component
public
class
TimesAspect
{
@Pointcut
(
"@annotation(com.yiring.common.annotation.Times)"
)
public
void
times
()
{}
@Around
(
"times()"
)
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
long
start
=
System
.
currentTimeMillis
();
try
{
return
point
.
proceed
();
}
finally
{
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"[Times] {}: {} ms"
,
getTimesValue
(
point
),
end
-
start
);
}
}
public
String
getTimesValue
(
JoinPoint
joinPoint
)
{
// 获取切入点的目标类
Class
<?>
targetClass
=
joinPoint
.
getTarget
().
getClass
();
// 获取切入方法名
String
methodName
=
joinPoint
.
getSignature
().
getName
();
// 获取切入方法参数
Object
[]
arguments
=
joinPoint
.
getArgs
();
// 获取目标类的所有方法
Method
[]
methods
=
targetClass
.
getMethods
();
String
timesValue
=
methodName
;
for
(
Method
method
:
methods
)
{
// 方法名相同、包含目标注解、方法参数个数相同(避免有重载)
if
(
method
.
getName
().
equals
(
methodName
)
&&
method
.
isAnnotationPresent
(
Times
.
class
)
&&
method
.
getParameterTypes
().
length
==
arguments
.
length
)
{
String
value
=
method
.
getAnnotation
(
Times
.
class
).
value
();
if
(
StrUtil
.
isNotEmpty
(
value
))
{
timesValue
=
value
;
}
}
}
return
timesValue
;
}
}
basic-common/util/src/main/java/com/yiring/common/aspect/XxlJobAspect.java
0 → 100644
浏览文件 @
69ac9fed
/* (C) 2021 YiRing, Inc. */
package
com
.
yiring
.
common
.
aspect
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.stereotype.Component
;
/**
* XxlJob 注解切面,修复无法输出异常的问题
*
* @author ifzm
* @version 0.1
*/
@Slf4j
@Aspect
@Component
@ConditionalOnClass
(
name
=
"com.xxl.job.core.handler.annotation.XxlJob"
)
public
class
XxlJobAspect
{
@Pointcut
(
"@annotation(com.xxl.job.core.handler.annotation.XxlJob)"
)
public
void
log
()
{}
@Around
(
"log()"
)
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
try
{
return
point
.
proceed
();
}
catch
(
Exception
e
)
{
log
.
error
(
"XxlJob Execute Error: "
+
e
.
getMessage
(),
e
);
throw
e
;
}
}
}
basic-common/util/src/main/java/com/yiring/common/util/Commons.java
浏览文件 @
69ac9fed
...
...
@@ -160,6 +160,11 @@ public class Commons {
@FunctionalInterface
public
interface
CallbackFunction
<
S
,
T
>
{
/**
* 执行方法
* @param s 源对象
* @param t 目标对象
*/
void
apply
(
S
s
,
T
t
);
}
}
build.gradle
浏览文件 @
69ac9fed
buildscript
{
repositories
{
maven
{
url
"https://plugins.gradle.org/m2/"
}
}
ext
{
// https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter
knife4jVersion
=
'2.0.9'
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
swaggerAnnotationsVersion
=
'1.6.6'
// https://mvnrepository.com/artifact/cn.dev33/sa-token-spring-boot-starter
saTokenVersion
=
'1.29.1.trial'
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
hutoolVersion
=
'5.8.0'
// https://mvnrepository.com/artifact/com.alibaba/fastjson
fastJsonVersion
=
'2.0.2'
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
xxlJobVersion
=
'2.3.0'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
okhttpVersion
=
'4.9.3'
// https://mvnrepository.com/artifact/io.minio/minio
minioVersion
=
'8.4.0'
// https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-55
hibernateTypesVersion
=
'2.16.2'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
hibernateSpatialVersion
=
'5.6.8.Final'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
jtsVersion
=
'1.18.2'
// https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
mybatisPlusVersion
=
'3.5.1'
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
myexcelVersion
=
'4.2.0'
}
}
plugins
{
id
'java'
id
'org.springframework.boot'
version
'2.6.7'
// https://start.spring.io
id
'org.springframework.boot'
version
'2.6.8'
// https://plugins.gradle.org/plugin/io.spring.dependency-management
id
'io.spring.dependency-management'
version
'1.0.11.RELEASE'
// https://plugins.gradle.org/plugin/com.diffplug.spotless
id
"com.diffplug.spotless"
version
"6.5.2"
// https://plugins.gradle.org/plugin/com.github.spotbugs
// id "com.github.spotbugs" version "5.0.6"
id
"com.diffplug.spotless"
version
"6.7.2"
}
ext
{
// Spotless
// https://www.npmjs.com/package/prettier
prettierVersion
=
'2.7.1'
// https://www.npmjs.com/package/prettier-plugin-java
prettierJavaVersion
=
'1.6.2'
// SpringCloud
// https://start.spring.io/
springCloudVersion
=
'2021.0.3'
// Dependencies
// https://mvnrepository.com/artifact/com.github.xiaoymin/knife4j-spring-boot-starter
knife4jVersion
=
'2.0.9'
// https://mvnrepository.com/artifact/io.swagger/swagger-annotations
swaggerAnnotationsVersion
=
'1.6.6'
// https://mvnrepository.com/artifact/cn.dev33/sa-token-spring-boot-starter
saTokenVersion
=
'1.30.0'
// https://mvnrepository.com/artifact/cn.hutool/hutool-all
hutoolVersion
=
'5.8.4.M1'
// https://mvnrepository.com/artifact/com.alibaba/fastjson
fastJsonVersion
=
'2.0.7'
// https://mvnrepository.com/artifact/com.xuxueli/xxl-job-core
xxlJobVersion
=
'2.3.1'
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
okhttpVersion
=
'4.9.3'
// https://mvnrepository.com/artifact/io.minio/minio
minioVersion
=
'8.4.2'
// https://mvnrepository.com/artifact/com.vladmihalcea/hibernate-types-55
hibernateTypesVersion
=
'2.16.2'
// https://mvnrepository.com/artifact/org.hibernate/hibernate-spatial
hibernateSpatialVersion
=
'5.6.9.Final'
// https://mvnrepository.com/artifact/org.locationtech.jts/jts-core
jtsVersion
=
'1.18.2'
// https://mvnrepository.com/artifact/com.baomidou/mybatis-plus-boot-starter
mybatisPlusVersion
=
'3.5.2'
// https://mvnrepository.com/artifact/com.github.liaochong/myexcel
myexcelVersion
=
'4.2.0'
}
allprojects
{
...
...
@@ -60,7 +65,6 @@ subprojects {
apply
plugin:
'org.springframework.boot'
apply
plugin:
'io.spring.dependency-management'
apply
plugin:
"com.diffplug.spotless"
// apply plugin: "com.github.spotbugs"
configurations
{
compileOnly
{
...
...
@@ -76,6 +80,12 @@ subprojects {
annotationProcessor
'org.springframework.boot:spring-boot-configuration-processor'
}
dependencyManagement
{
imports
{
mavenBom
"org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
[
compileJava
,
compileTestJava
,
javadoc
]*.
options
*.
encoding
=
'UTF-8'
tasks
.
withType
(
JavaCompile
)
{
...
...
@@ -86,7 +96,7 @@ subprojects {
enabled
=
false
}
t
est
{
t
asks
.
named
(
'test'
)
{
useJUnitPlatform
()
}
...
...
@@ -110,9 +120,7 @@ subprojects {
importOrder
()
removeUnusedImports
()
licenseHeader
'/* (C) $YEAR YiRing, Inc. */'
// https://www.npmjs.com/package/prettier
// https://www.npmjs.com/package/prettier-plugin-java
prettier
([
'prettier'
:
'2.6.2'
,
'prettier-plugin-java'
:
'1.6.1'
]).
config
([
prettier
([
'prettier'
:
prettierVersion
,
'prettier-plugin-java'
:
prettierJavaVersion
]).
config
([
'parser'
:
'java'
,
'tabWidth'
:
4
,
'printWidth'
:
120
,
...
...
@@ -123,6 +131,7 @@ subprojects {
}
task
hooks
()
{
// fix: CI/CD
try
{
// GitHook pre-commit (spotless, spotbugs)
def
hook
=
new
File
(
"$rootProject.projectDir/.git/hooks/pre-commit"
)
...
...
@@ -139,7 +148,6 @@ task hooks() {
gradle
.
getTaskGraph
().
whenReady
{
def
skipHooks
=
gradle
.
startParameter
.
getSystemPropertiesArgs
().
containsKey
(
'skip-hooks'
)
printf
(
"skip-hooks: %s"
,
skipHooks
)
if
(!
skipHooks
)
{
hooks
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论