Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
usedCarAuction
/
aus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit bfbe7c55
authored
Apr 18, 2026
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:openapi 静态资源放行
1 parent
34c1e290
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
163 additions
and
47 deletions
aus-core/src/main/java/com/glsx/usedcar/annotation/DataPermission.java
aus-core/src/main/java/com/glsx/usedcar/aspect/DataPermissionAspect.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/config/VrLoginProperties.java
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrUserService.java
aus-core/src/main/java/com/glsx/usedcar/util/UserContext.java
aus-vr-api/src/main/java/com/glsx/usedcar/controller/VrAuditController.java
aus-vr/src/main/java/com/glsx/usedcar/controller/VrAuditController.java
aus-core/src/main/java/com/glsx/usedcar/annotation/DataPermission.java
View file @
bfbe7c5
package
com
.
glsx
.
usedcar
.
annotation
;
package
com
.
glsx
.
usedcar
.
annotation
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.Retention
;
...
@@ -10,9 +12,13 @@ import java.lang.annotation.Target;
...
@@ -10,9 +12,13 @@ import java.lang.annotation.Target;
* 数据权限注解
* 数据权限注解
* 标注在方法上,切面自动根据当前用户角色注入数据权限过滤
* 标注在方法上,切面自动根据当前用户角色注入数据权限过滤
*
*
* Pagination 类型参数:自动 addFilter(key, userIds, Operator.in)
* Pagination 类型参数:自动 addFilter(key, ids, Operator.in)
* 非 Pagination 参数:通过 request attribute 传递 "X-Data-Permission-{key}"
* Map 类型参数:map.put(key, ids)
* @author 20109
* 普通对象参数:通过反射设置 key 对应的字段
* request attribute:通过 "X-Data-Permission-{key}" 传递
*
* @author yangwei
* @since 2026/4/17
*/
*/
@Target
({
ElementType
.
METHOD
})
@Target
({
ElementType
.
METHOD
})
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
...
@@ -21,6 +27,15 @@ public @interface DataPermission {
...
@@ -21,6 +27,15 @@ public @interface DataPermission {
/**
/**
* 过滤字段名,如 "vrUserId"、"orgId"
* 过滤字段名,如 "vrUserId"、"orgId"
*
* @return 过滤字段名
*/
*/
String
key
();
String
key
();
/**
* 权限类型,决定获取用户ID还是组织ID,默认为用户ID
*
* @return 权限类型
*/
DataPermissionType
type
()
default
DataPermissionType
.
USER_ID
;
}
}
aus-core/src/main/java/com/glsx/usedcar/aspect/DataPermissionAspect.java
View file @
bfbe7c5
package
com
.
glsx
.
usedcar
.
aspect
;
package
com
.
glsx
.
usedcar
.
aspect
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.glsx.usedcar.annotation.DataPermission
;
import
com.glsx.usedcar.annotation.DataPermission
;
import
com.glsx.usedcar.config.VrApplicationCondition
;
import
com.glsx.usedcar.config.VrApplicationCondition
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.consts.common.SymbolConsts
;
import
com.glsx.usedcar.enums.common.DataPermissionType
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.DeleteFlag
;
import
com.glsx.usedcar.enums.common.VrRoleCodeEnum
;
import
com.glsx.usedcar.enums.common.VrRoleCodeEnum
;
import
com.glsx.usedcar.module.vrsystem.dao.VrOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrRoleRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrRoleRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dao.VrUserOrgRepository
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.module.vrsystem.entity.VrOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrRole
;
import
com.glsx.usedcar.module.vrsystem.entity.VrRole
;
import
com.glsx.usedcar.module.vrsystem.entity.VrUserOrg
;
import
com.glsx.usedcar.module.vrsystem.entity.VrUserOrg
;
import
com.glsx.usedcar.util.UserContext
;
import
com.glsx.usedcar.util.UserContext
;
...
@@ -38,8 +40,8 @@ import java.util.stream.Collectors;
...
@@ -38,8 +40,8 @@ import java.util.stream.Collectors;
* 根据当前用户角色自动注入数据权限过滤
* 根据当前用户角色自动注入数据权限过滤
*
*
* - SYSTEM_ADMIN:不做过滤,可查看所有数据
* - SYSTEM_ADMIN:不做过滤,可查看所有数据
* - GROUP_ACCOUNT:查看集团及旗下所有门店的
用户
数据
* - GROUP_ACCOUNT:查看集团及旗下所有门店的数据
* - STORE_ACCOUNT:仅查看所在门店的
用户
数据
* - STORE_ACCOUNT:仅查看所在门店的数据
*
*
* @author yangwei
* @author yangwei
* @since 2026/4/17
* @since 2026/4/17
...
@@ -53,6 +55,7 @@ public class DataPermissionAspect {
...
@@ -53,6 +55,7 @@ public class DataPermissionAspect {
private
final
VrRoleRepository
vrRoleRepository
;
private
final
VrRoleRepository
vrRoleRepository
;
private
final
VrUserOrgRepository
vrUserOrgRepository
;
private
final
VrUserOrgRepository
vrUserOrgRepository
;
private
final
VrOrgRepository
vrOrgRepository
;
private
static
final
String
PERMISSION_ATTR_PREFIX
=
"X-Data-Permission-"
;
private
static
final
String
PERMISSION_ATTR_PREFIX
=
"X-Data-Permission-"
;
...
@@ -84,16 +87,17 @@ public class DataPermissionAspect {
...
@@ -84,16 +87,17 @@ public class DataPermissionAspect {
return
;
return
;
}
}
// 3. 获取权限范围
// 3. 根据权限类型获取允许的ID列表
List
<
Long
>
allowedUserIds
=
getAllowedUserIds
(
currentUser
);
DataPermissionType
type
=
dataPermission
.
type
();
if
(
CollectionUtils
.
isEmpty
(
allowedUserIds
))
{
List
<
Long
>
allowedIds
=
resolveAllowedIds
(
currentUser
,
type
);
if
(
CollectionUtils
.
isEmpty
(
allowedIds
))
{
// 哨兵值,确保无数据返回
// 哨兵值,确保无数据返回
allowed
User
Ids
=
Collections
.
singletonList
(-
1L
);
allowedIds
=
Collections
.
singletonList
(-
1L
);
log
.
warn
(
"用户 {} 无数据权限
,将返回空数据"
,
currentUser
.
getUserId
());
log
.
warn
(
"用户 {} 无数据权限
(type={}),将返回空数据"
,
currentUser
.
getUserId
(),
type
.
getCode
());
}
}
// 4. 注入权限
// 4. 注入权限
injectDataPermission
(
joinPoint
,
dataPermission
,
allowed
User
Ids
,
currentUser
);
injectDataPermission
(
joinPoint
,
dataPermission
,
allowedIds
,
currentUser
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"数据权限注入失败"
,
e
);
log
.
error
(
"数据权限注入失败"
,
e
);
...
@@ -130,12 +134,26 @@ public class DataPermissionAspect {
...
@@ -130,12 +134,26 @@ public class DataPermissionAspect {
}
}
/**
/**
* 获取允许的用户ID列表
* 根据权限类型解析允许的ID列表
*
* @param currentUser 当前登录用户
* @param type 权限类型
* @return 允许的ID列表
*/
private
List
<
Long
>
resolveAllowedIds
(
LoginUserDTO
currentUser
,
DataPermissionType
type
)
{
if
(
type
==
DataPermissionType
.
ORG_ID
)
{
return
resolveAllowedOrgIds
(
currentUser
);
}
return
resolveAllowedUserIds
(
currentUser
);
}
/**
* 解析允许的用户ID列表
*
*
* @param currentUser 当前登录用户
* @param currentUser 当前登录用户
* @return 允许的用户ID列表
* @return 允许的用户ID列表
*/
*/
private
List
<
Long
>
get
AllowedUserIds
(
LoginUserDTO
currentUser
)
{
private
List
<
Long
>
resolve
AllowedUserIds
(
LoginUserDTO
currentUser
)
{
Long
roleId
=
currentUser
.
getRoleId
();
Long
roleId
=
currentUser
.
getRoleId
();
Long
orgId
=
currentUser
.
getOrgId
();
Long
orgId
=
currentUser
.
getOrgId
();
...
@@ -143,7 +161,6 @@ public class DataPermissionAspect {
...
@@ -143,7 +161,6 @@ public class DataPermissionAspect {
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
// 查询角色编码
VrRole
role
=
vrRoleRepository
.
findByIdAndDeleteFlag
(
roleId
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
VrRole
role
=
vrRoleRepository
.
findByIdAndDeleteFlag
(
roleId
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
orElse
(
null
);
.
orElse
(
null
);
if
(
role
==
null
)
{
if
(
role
==
null
)
{
...
@@ -168,37 +185,76 @@ public class DataPermissionAspect {
...
@@ -168,37 +185,76 @@ public class DataPermissionAspect {
}
}
/**
/**
* 解析允许的组织ID列表
*
* @param currentUser 当前登录用户
* @return 允许的组织ID列表
*/
private
List
<
Long
>
resolveAllowedOrgIds
(
LoginUserDTO
currentUser
)
{
Long
roleId
=
currentUser
.
getRoleId
();
Long
orgId
=
currentUser
.
getOrgId
();
if
(
roleId
==
null
||
orgId
==
null
)
{
return
Collections
.
emptyList
();
}
VrRole
role
=
vrRoleRepository
.
findByIdAndDeleteFlag
(
roleId
,
DeleteFlag
.
NOT_DELETED
.
getCode
())
.
orElse
(
null
);
if
(
role
==
null
)
{
return
Collections
.
emptyList
();
}
String
roleCode
=
role
.
getRoleCode
();
// 集团账号:集团本身 + 旗下所有门店
if
(
VrRoleCodeEnum
.
GROUP_ACCOUNT
.
getCode
().
equals
(
roleCode
))
{
List
<
Long
>
orgIds
=
new
ArrayList
<>();
orgIds
.
add
(
orgId
);
List
<
VrOrg
>
childOrgs
=
vrOrgRepository
.
findByParentIdAndDeleteFlagOrderBySortOrderAsc
(
orgId
,
DeleteFlag
.
NOT_DELETED
.
getCode
());
orgIds
.
addAll
(
childOrgs
.
stream
().
map
(
VrOrg:
:
getId
).
toList
());
return
orgIds
;
}
// 门店账号:仅所在门店
if
(
VrRoleCodeEnum
.
STORE_ACCOUNT
.
getCode
().
equals
(
roleCode
))
{
return
Collections
.
singletonList
(
orgId
);
}
return
Collections
.
emptyList
();
}
/**
* 注入数据权限到方法参数
* 注入数据权限到方法参数
*
*
* @param joinPoint 连接点
* @param joinPoint 连接点
* @param dataPermission 数据权限注解
* @param dataPermission 数据权限注解
* @param allowed
UserIds 允许的用户
ID列表
* @param allowed
Ids 允许的
ID列表
* @param currentUser 当前登录用户
* @param currentUser 当前登录用户
*/
*/
private
void
injectDataPermission
(
JoinPoint
joinPoint
,
DataPermission
dataPermission
,
private
void
injectDataPermission
(
JoinPoint
joinPoint
,
DataPermission
dataPermission
,
List
<
Long
>
allowed
User
Ids
,
LoginUserDTO
currentUser
)
{
List
<
Long
>
allowedIds
,
LoginUserDTO
currentUser
)
{
String
key
=
dataPermission
.
key
();
String
key
=
dataPermission
.
key
();
Object
[]
args
=
joinPoint
.
getArgs
();
Object
[]
args
=
joinPoint
.
getArgs
();
if
(
ObjectUtil
.
isNotNull
(
args
))
{
if
(
ObjectUtil
.
isNotNull
(
args
))
{
Object
arg1
=
args
[
0
];
Object
arg1
=
args
[
0
];
if
(
arg1
instanceof
Pagination
)
{
if
(
arg1
instanceof
Pagination
)
{
injectPaginationPermission
((
Pagination
<?>)
arg1
,
key
,
allowed
User
Ids
);
injectPaginationPermission
((
Pagination
<?>)
arg1
,
key
,
allowedIds
);
}
else
if
(
arg1
instanceof
Map
)
{
}
else
if
(
arg1
instanceof
Map
)
{
injectMapPermission
((
Map
<?,
?>)
arg1
,
key
,
allowed
User
Ids
);
injectMapPermission
((
Map
<?,
?>)
arg1
,
key
,
allowedIds
);
}
else
if
(
arg1
!=
null
)
{
}
else
if
(
arg1
!=
null
)
{
injectByReflection
(
arg1
,
key
,
allowed
User
Ids
);
injectByReflection
(
arg1
,
key
,
allowedIds
);
}
}
}
else
{
}
else
{
Optional
.
ofNullable
(
RequestContextHolder
.
getRequestAttributes
())
Optional
.
ofNullable
(
RequestContextHolder
.
getRequestAttributes
())
.
ifPresent
(
requestAttributes
->
requestAttributes
.
setAttribute
(
.
ifPresent
(
requestAttributes
->
requestAttributes
.
setAttribute
(
PERMISSION_ATTR_PREFIX
+
key
,
PERMISSION_ATTR_PREFIX
+
key
,
allowed
User
Ids
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
SymbolConsts
.
COMMA
)),
allowedIds
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
SymbolConsts
.
COMMA
)),
RequestAttributes
.
SCOPE_REQUEST
));
RequestAttributes
.
SCOPE_REQUEST
));
}
}
log
.
debug
(
"数据权限注入成功: user={},
key={}, userI
ds={}"
,
log
.
debug
(
"数据权限注入成功: user={},
type={}, key={}, i
ds={}"
,
currentUser
.
getUserId
(),
key
,
allowedUser
Ids
);
currentUser
.
getUserId
(),
dataPermission
.
type
().
getCode
(),
key
,
allowed
Ids
);
}
}
/**
/**
...
@@ -206,10 +262,10 @@ public class DataPermissionAspect {
...
@@ -206,10 +262,10 @@ public class DataPermissionAspect {
*
*
* @param pagination 分页对象
* @param pagination 分页对象
* @param key 过滤字段名
* @param key 过滤字段名
* @param
userIds 允许的用户
ID列表
* @param
ids 允许的
ID列表
*/
*/
private
void
injectPaginationPermission
(
Pagination
<?>
pagination
,
String
key
,
List
<
Long
>
userI
ds
)
{
private
void
injectPaginationPermission
(
Pagination
<?>
pagination
,
String
key
,
List
<
Long
>
i
ds
)
{
Filter
filter
=
new
Filter
(
key
,
userI
ds
,
Operator
.
in
,
Logic
.
and
);
Filter
filter
=
new
Filter
(
key
,
i
ds
,
Operator
.
in
,
Logic
.
and
);
pagination
.
addFilter
(
filter
);
pagination
.
addFilter
(
filter
);
}
}
...
@@ -218,12 +274,12 @@ public class DataPermissionAspect {
...
@@ -218,12 +274,12 @@ public class DataPermissionAspect {
*
*
* @param map Map对象
* @param map Map对象
* @param key 过滤字段名
* @param key 过滤字段名
* @param
userIds 允许的用户
ID列表
* @param
ids 允许的
ID列表
*/
*/
@SuppressWarnings
(
"unchecked"
)
@SuppressWarnings
(
"unchecked"
)
private
void
injectMapPermission
(
Map
<?,
?>
map
,
String
key
,
List
<
Long
>
userI
ds
)
{
private
void
injectMapPermission
(
Map
<?,
?>
map
,
String
key
,
List
<
Long
>
i
ds
)
{
if
(
map
instanceof
HashMap
)
{
if
(
map
instanceof
HashMap
)
{
((
HashMap
<
String
,
Object
>)
map
).
put
(
key
,
userI
ds
);
((
HashMap
<
String
,
Object
>)
map
).
put
(
key
,
i
ds
);
}
}
}
}
...
@@ -232,20 +288,19 @@ public class DataPermissionAspect {
...
@@ -232,20 +288,19 @@ public class DataPermissionAspect {
*
*
* @param target 目标对象
* @param target 目标对象
* @param key 过滤字段名
* @param key 过滤字段名
* @param
userIds 允许的用户
ID列表
* @param
ids 允许的
ID列表
*/
*/
private
void
injectByReflection
(
Object
target
,
String
key
,
List
<
Long
>
userI
ds
)
{
private
void
injectByReflection
(
Object
target
,
String
key
,
List
<
Long
>
i
ds
)
{
try
{
try
{
Field
field
=
target
.
getClass
().
getDeclaredField
(
key
);
Field
field
=
target
.
getClass
().
getDeclaredField
(
key
);
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
field
.
set
(
target
,
userI
ds
);
field
.
set
(
target
,
i
ds
);
}
catch
(
NoSuchFieldException
e
)
{
}
catch
(
NoSuchFieldException
e
)
{
// 不是所有对象都有这个字段,无改字段加入到请求头当中
// 不是所有对象都有这个字段,加入到请求上下文
// 将权限信息存储到请求上下文,供非Pagination场景使用
Optional
.
ofNullable
(
RequestContextHolder
.
getRequestAttributes
())
Optional
.
ofNullable
(
RequestContextHolder
.
getRequestAttributes
())
.
ifPresent
(
requestAttributes
->
requestAttributes
.
setAttribute
(
.
ifPresent
(
requestAttributes
->
requestAttributes
.
setAttribute
(
PERMISSION_ATTR_PREFIX
+
key
,
PERMISSION_ATTR_PREFIX
+
key
,
userI
ds
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
SymbolConsts
.
COMMA
)),
i
ds
.
stream
().
map
(
Object:
:
toString
).
collect
(
Collectors
.
joining
(
SymbolConsts
.
COMMA
)),
RequestAttributes
.
SCOPE_REQUEST
));
RequestAttributes
.
SCOPE_REQUEST
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
warn
(
"反射注入数据权限失败: target={}, key={}"
,
target
.
getClass
().
getSimpleName
(),
key
,
e
);
log
.
warn
(
"反射注入数据权限失败: target={}, key={}"
,
target
.
getClass
().
getSimpleName
(),
key
,
e
);
...
...
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/config/VrLoginProperties.java
View file @
bfbe7c5
...
@@ -30,5 +30,13 @@ public class VrLoginProperties {
...
@@ -30,5 +30,13 @@ public class VrLoginProperties {
/**
/**
* 登录接口免拦截路径
* 登录接口免拦截路径
*/
*/
private
String
[]
excludePaths
=
{
"/rest/login"
,
"/doc.html"
,
"/swagger-ui/**"
,
"/v3/api-docs/**"
};
private
String
[]
excludePaths
=
{
"/rest/login"
,
"/doc.html"
,
"/swagger-ui/**"
,
"/v3/api-docs/**"
,
"/doc.html"
,
"/swagger-resources/**"
,
"/webjars/**"
};
}
}
aus-core/src/main/java/com/glsx/usedcar/module/vrsystem/service/VrUserService.java
View file @
bfbe7c5
...
@@ -285,7 +285,6 @@ public class VrUserService {
...
@@ -285,7 +285,6 @@ public class VrUserService {
/**
/**
* 分页查询用户(使用 JPA 关联查询)
* 分页查询用户(使用 JPA 关联查询)
*/
*/
@DataPermission
(
key
=
"vrUserId"
)
public
Page
<
VrUserPageRespVO
>
pageUsers
(
VrUserPageQueryVO
queryVO
)
{
public
Page
<
VrUserPageRespVO
>
pageUsers
(
VrUserPageQueryVO
queryVO
)
{
// 构建分页参数(page从1开始)
// 构建分页参数(page从1开始)
int
page
=
queryVO
.
getPage
()
==
null
||
queryVO
.
getPage
()
<
1
?
1
:
queryVO
.
getPage
();
int
page
=
queryVO
.
getPage
()
==
null
||
queryVO
.
getPage
()
<
1
?
1
:
queryVO
.
getPage
();
...
...
aus-core/src/main/java/com/glsx/usedcar/util/UserContext.java
View file @
bfbe7c5
...
@@ -3,6 +3,7 @@ package com.glsx.usedcar.util;
...
@@ -3,6 +3,7 @@ package com.glsx.usedcar.util;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
import
com.glsx.usedcar.module.vrsystem.dto.LoginUserDTO
;
/**
/**
* 发拍端专用用户上下文
* 用户上下文(ThreadLocal存储)
* 用户上下文(ThreadLocal存储)
*
*
* @author yangwei
* @author yangwei
...
...
aus-vr-api/src/main/java/com/glsx/usedcar/controller/VrAuditController.java
View file @
bfbe7c5
...
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
...
@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Pagination
;
import
org.summerframework.orm.paging.Pagination
;
import
java.util.Optional
;
/**
/**
* 发拍单管理 Controller
* 发拍单管理 Controller
*
*
...
@@ -55,8 +57,8 @@ public class VrAuditController {
...
@@ -55,8 +57,8 @@ public class VrAuditController {
int
page
=
req
.
getPage
()
==
null
||
req
.
getPage
()
<
1
?
1
:
req
.
getPage
();
int
page
=
req
.
getPage
()
==
null
||
req
.
getPage
()
<
1
?
1
:
req
.
getPage
();
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
Pagination
<
VrAudit
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
Pagination
<
VrAudit
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
STATUS
,
req
.
getStatus
(),
Operator
.
eq
);
Optional
.
ofNullable
(
req
.
getStatus
())
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
VR_USER_ID
,
UserContext
.
getUser
().
getUserId
(),
Operator
.
eq
);
.
ifPresent
(
status
->
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
STATUS
,
status
,
Operator
.
eq
)
);
if
(
StringUtils
.
isNotBlank
(
req
.
getKeyword
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getKeyword
()))
{
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
KEYWORD
,
req
.
getKeyword
(),
Operator
.
eq
);
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
KEYWORD
,
req
.
getKeyword
(),
Operator
.
eq
);
}
}
...
...
aus-vr/src/main/java/com/glsx/usedcar/controller/VrAuditController.java
View file @
bfbe7c5
package
com
.
glsx
.
usedcar
.
controller
;
package
com
.
glsx
.
usedcar
.
controller
;
import
cn.hutool.core.lang.func.LambdaUtil
;
import
com.glsx.usedcar.consts.common.CommonConsts
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.consts.inspect.JpaQueryConstants
;
import
com.glsx.usedcar.module.vrsystem.entity.VrAudit
;
import
com.glsx.usedcar.module.vrsystem.entity.VrAudit
;
import
com.glsx.usedcar.module.vrsystem.service.VrAuditService
;
import
com.glsx.usedcar.module.vrsystem.service.VrAuditService
;
...
@@ -15,13 +17,13 @@ import lombok.RequiredArgsConstructor;
...
@@ -15,13 +17,13 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.summerframework.orm.entity.AuditingTimeEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Operator
;
import
org.summerframework.orm.paging.Pagination
;
import
org.summerframework.orm.paging.Pagination
;
import
java.util.Optional
;
/**
/**
* 发拍单管理 Controller
* 发拍单管理 Controller
*
*
...
@@ -47,14 +49,48 @@ public class VrAuditController {
...
@@ -47,14 +49,48 @@ public class VrAuditController {
int
page
=
req
.
getPage
()
==
null
||
req
.
getPage
()
<
1
?
1
:
req
.
getPage
();
int
page
=
req
.
getPage
()
==
null
||
req
.
getPage
()
<
1
?
1
:
req
.
getPage
();
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
int
size
=
req
.
getSize
()
==
null
||
req
.
getSize
()
<
1
?
20
:
req
.
getSize
();
Pagination
<
VrAudit
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
Pagination
<
VrAudit
>
pagination
=
new
Pagination
<>((
page
-
1
)
*
size
,
size
);
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
STATUS
,
req
.
getStatus
(),
Operator
.
eq
);
Optional
.
ofNullable
(
req
.
getStatus
())
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
VR_USER_ID
,
UserContext
.
getUser
().
getUserId
(),
Operator
.
eq
);
.
ifPresent
(
status
->
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
STATUS
,
status
,
Operator
.
eq
)
);
if
(
StringUtils
.
isNotBlank
(
req
.
getKeyword
()))
{
if
(
StringUtils
.
isNotBlank
(
req
.
getKeyword
()))
{
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
KEYWORD
,
req
.
getKeyword
(),
Operator
.
eq
);
pagination
.
addFilter
(
JpaQueryConstants
.
VrAudit
.
KEYWORD
,
req
.
getKeyword
(),
Operator
.
eq
);
}
}
pagination
.
setSort
(
"createTime"
);
pagination
.
setSort
(
LambdaUtil
.
getFieldName
(
AuditingTimeEntity:
:
getCreateTime
)
);
pagination
.
setOrder
(
"desc"
);
pagination
.
setOrder
(
CommonConsts
.
DESC
);
Page
<
VrAuditRespVO
>
result
=
vrAuditService
.
pageList
(
pagination
);
Page
<
VrAuditRespVO
>
result
=
vrAuditService
.
pageList
(
pagination
);
return
BaseResp
.
success
(
result
);
return
BaseResp
.
success
(
result
);
}
}
/**
* 查询发拍单详情
*/
@GetMapping
(
"/detail/{id}"
)
@Operation
(
summary
=
"查询发拍单详情"
,
description
=
"根据发拍单ID查询详情信息"
)
public
BaseResp
<
VrAuditRespVO
>
detail
(
@PathVariable
Long
id
)
{
VrAuditRespVO
result
=
vrAuditService
.
getById
(
id
);
return
BaseResp
.
success
(
result
);
}
/**
* 下架发拍单
* <p>仅草稿状态和待拍卖状态可以下架</p>
*/
@GetMapping
(
"/offShelf/{id}"
)
@Operation
(
summary
=
"下架发拍单"
,
description
=
"仅草稿状态和待拍卖状态可以下架,下架后状态变更为已下架"
)
public
BaseResp
<
Void
>
offShelf
(
@PathVariable
Long
id
)
{
String
operator
=
UserContext
.
getUser
().
getUserName
();
vrAuditService
.
offShelf
(
id
,
operator
);
return
BaseResp
.
success
(
null
,
"下架成功"
);
}
/**
* 重新发拍
* <p>仅已下架和流拍状态可以重新发拍,且必须已同步到车辆档案</p>
*/
@GetMapping
(
"/rePublish/{id}"
)
@Operation
(
summary
=
"重新发拍"
,
description
=
"仅已下架和流拍状态可以重新发拍,且必须已同步到车辆档案;重新发拍后状态变更为待拍卖"
)
public
BaseResp
<
Void
>
rePublish
(
@PathVariable
Long
id
)
{
String
operator
=
UserContext
.
getUser
().
getUserName
();
vrAuditService
.
rePublish
(
id
,
operator
);
return
BaseResp
.
success
(
null
,
"重新发拍成功"
);
}
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment