记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董敬伟
liquidnet-bus-v1
Commits
174aa13c
Commit
174aa13c
authored
Aug 21, 2025
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LostFoundAdmin add redis info
parent
9b61cc87
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
19 deletions
+61
-19
ISweetLostFoundAdminService.java
...et/service/sweet/service/ISweetLostFoundAdminService.java
+9
-0
SweetLostFoundAdminController.java
...rvice/sweet/controller/SweetLostFoundAdminController.java
+8
-0
SweetLostFoundAdminServiceImpl.java
...ce/sweet/service/impl/SweetLostFoundAdminServiceImpl.java
+31
-10
LostFoundRedisUtils.java
...om/liquidnet/service/sweet/utils/LostFoundRedisUtils.java
+13
-9
No files found.
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/service/ISweetLostFoundAdminService.java
View file @
174aa13c
...
...
@@ -55,4 +55,13 @@ public interface ISweetLostFoundAdminService extends IService<SweetLostFoundAdmi
*/
List
<
SweetLostFoundAdminVo
>
getAdminList
(
String
performanceId
);
/**
* 检查是否有管理员权限
*
* @param phone 手机号
* @param performanceId 演出ID
* @return 权限详情信息
*/
SweetLostFoundAdminVo
hasPermission
(
String
phone
,
String
performanceId
);
}
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetLostFoundAdminController.java
View file @
174aa13c
...
...
@@ -60,4 +60,12 @@ public class SweetLostFoundAdminController {
public
ResponseDto
<
List
<
SweetLostFoundAdminVo
>>
getAdminList
(
@ApiParam
(
"演出ID"
)
@PathVariable
String
performanceId
)
{
return
ResponseDto
.
success
(
sweetLostFoundAdminService
.
getAdminList
(
performanceId
));
}
@GetMapping
(
"/permission/{phone}/{performanceId}"
)
@ApiOperation
(
"获取权限"
)
public
ResponseDto
<
SweetLostFoundAdminVo
>
getPermission
(
@ApiParam
(
"手机号"
)
@PathVariable
String
phone
,
@ApiParam
(
"演出ID"
)
@PathVariable
String
performanceId
)
{
return
ResponseDto
.
success
(
sweetLostFoundAdminService
.
hasPermission
(
phone
,
performanceId
));
}
}
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetLostFoundAdminServiceImpl.java
View file @
174aa13c
...
...
@@ -7,8 +7,10 @@ import com.liquidnet.service.sweet.entity.SweetLostFoundAdmin;
import
com.liquidnet.service.sweet.mapper.SweetLostFoundAdminMapper
;
import
com.liquidnet.service.sweet.param.SweetLostFoundAdminParam
;
import
com.liquidnet.service.sweet.service.ISweetLostFoundAdminService
;
import
com.liquidnet.service.sweet.utils.LostFoundRedisUtils
;
import
com.liquidnet.service.sweet.vo.SweetLostFoundAdminVo
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
...
...
@@ -23,6 +25,9 @@ import java.util.stream.Collectors;
@Service
public
class
SweetLostFoundAdminServiceImpl
extends
ServiceImpl
<
SweetLostFoundAdminMapper
,
SweetLostFoundAdmin
>
implements
ISweetLostFoundAdminService
{
@Autowired
private
LostFoundRedisUtils
lostFoundRedisUtils
;
@Override
public
boolean
addAdmin
(
SweetLostFoundAdminParam
admin
)
{
SweetLostFoundAdmin
foundAdmin
=
SweetLostFoundAdmin
.
getNew
();
...
...
@@ -81,16 +86,11 @@ public class SweetLostFoundAdminServiceImpl extends ServiceImpl<SweetLostFoundAd
queryWrapper
.
eq
(
"is_deleted"
,
0
);
// 查询条件:performanceId = 指定演出ID OR authScope = 2(全站)
if
(
performanceId
!=
null
&&
!
performanceId
.
trim
().
isEmpty
())
{
queryWrapper
.
and
(
wrapper
->
wrapper
.
eq
(
"performance_id"
,
performanceId
.
trim
())
.
or
()
.
eq
(
"auth_scope"
,
2
)
);
}
else
{
// 如果没有performanceId,只查authScope=2的全站管理员
queryWrapper
.
eq
(
"auth_scope"
,
2
);
}
queryWrapper
.
and
(
wrapper
->
wrapper
.
eq
(
"performance_id"
,
performanceId
.
trim
())
.
or
()
.
eq
(
"auth_scope"
,
2
)
);
// 默认按创建时间降序
queryWrapper
.
orderByDesc
(
"create_time"
);
...
...
@@ -109,4 +109,25 @@ public class SweetLostFoundAdminServiceImpl extends ServiceImpl<SweetLostFoundAd
return
voList
;
}
@Override
public
SweetLostFoundAdminVo
hasPermission
(
String
phone
,
String
performanceId
)
{
SweetLostFoundAdminVo
adminCache
=
lostFoundRedisUtils
.
getAdminCache
(
phone
,
performanceId
);
if
(
adminCache
==
null
)
{
QueryWrapper
<
SweetLostFoundAdmin
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"phone"
,
phone
.
trim
())
.
eq
(
"is_deleted"
,
0
);
queryWrapper
.
and
(
wrapper
->
wrapper
.
eq
(
"performance_id"
,
performanceId
.
trim
())
.
or
()
.
eq
(
"auth_scope"
,
2
)
);
SweetLostFoundAdmin
admin
=
baseMapper
.
selectOne
(
queryWrapper
);
SweetLostFoundAdminVo
vo
=
new
SweetLostFoundAdminVo
();
BeanUtils
.
copyProperties
(
admin
,
vo
);
lostFoundRedisUtils
.
setAdminCache
(
phone
,
performanceId
,
vo
);
return
vo
;
}
return
adminCache
;
}
}
\ No newline at end of file
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/LostFoundRedisUtils.java
View file @
174aa13c
package
com
.
liquidnet
.
service
.
sweet
.
utils
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.service.sweet.vo.SweetLostFoundAdminVo
;
import
com.liquidnet.service.sweet.vo.SweetLostFoundItemVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -26,7 +27,7 @@ public class LostFoundRedisUtils {
private
static
final
String
LOST_FOUND_KEY_PREFIX
=
"sweet:lost_found:"
;
private
static
final
String
ITEM_LIST_KEY
=
LOST_FOUND_KEY_PREFIX
+
"item_list:"
;
private
static
final
String
ITEM_DETAIL_KEY
=
LOST_FOUND_KEY_PREFIX
+
"item_detail:"
;
private
static
final
String
ADMIN_
LIST_KEY
=
LOST_FOUND_KEY_PREFIX
+
"admin_list
:"
;
private
static
final
String
ADMIN_
DETAIL_KEY
=
LOST_FOUND_KEY_PREFIX
+
"admin_detail
:"
;
// 缓存过期时间(秒)
private
static
final
long
LIST_EXPIRE_TIME
=
432000
;
// 5天
...
...
@@ -159,14 +160,17 @@ public class LostFoundRedisUtils {
* @param performanceId 演出ID
* @return 是否存在
*/
public
boolean
isAdminExists
(
String
phone
,
String
performanceId
)
{
public
SweetLostFoundAdminVo
getAdminCache
(
String
phone
,
String
performanceId
)
{
try
{
String
key
=
ADMIN_LIST_KEY
+
phone
+
":"
+
performanceId
;
return
redisUtil
.
hasKey
(
key
);
String
key
=
ADMIN_DETAIL_KEY
+
phone
+
":"
+
performanceId
;
Object
cachedValue
=
redisUtil
.
get
(
key
);
if
(
cachedValue
!=
null
)
{
return
(
SweetLostFoundAdminVo
)
cachedValue
;
}
}
catch
(
Exception
e
)
{
log
.
error
(
"检查管理员缓存失败"
,
e
);
return
false
;
}
return
null
;
}
/**
...
...
@@ -174,12 +178,12 @@ public class LostFoundRedisUtils {
*
* @param phone 手机号
* @param performanceId 演出ID
* @param
isAdmin 是否是管理员
* @param
vo 管理员信息
*/
public
void
setAdminCache
(
String
phone
,
String
performanceId
,
boolean
isAdmin
)
{
public
void
setAdminCache
(
String
phone
,
String
performanceId
,
SweetLostFoundAdminVo
vo
)
{
try
{
String
key
=
ADMIN_
LIST
_KEY
+
phone
+
":"
+
performanceId
;
redisUtil
.
set
(
key
,
isAdmin
,
1800
);
// 30分钟
String
key
=
ADMIN_
DETAIL
_KEY
+
phone
+
":"
+
performanceId
;
redisUtil
.
set
(
key
,
vo
,
DETAIL_EXPIRE_TIME
);
}
catch
(
Exception
e
)
{
log
.
error
(
"设置管理员缓存失败"
,
e
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment