记得上下班打卡 | 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
9607bee7
Commit
9607bee7
authored
May 18, 2026
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草莓护照v1.1- 优化演出名称查询效率
parent
2ee8d88c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
75 deletions
+99
-75
AdamCaomeiPerformanceIdTitleDto.java
...net/service/adam/dto/AdamCaomeiPerformanceIdTitleDto.java
+9
-0
AdamCaomeiBadgeMapper.java
.../liquidnet/service/adam/mapper/AdamCaomeiBadgeMapper.java
+13
-0
AdamRdmService.java
...va/com/liquidnet/service/adam/service/AdamRdmService.java
+54
-12
AdamCaomeiPassportUserServiceImpl.java
.../adam/service/impl/AdamCaomeiPassportUserServiceImpl.java
+23
-63
No files found.
liquidnet-bus-do/liquidnet-service-adam-do/src/main/java/com/liquidnet/service/adam/dto/AdamCaomeiPerformanceIdTitleDto.java
0 → 100644
View file @
9607bee7
package
com
.
liquidnet
.
service
.
adam
.
dto
;
import
lombok.Data
;
@Data
public
class
AdamCaomeiPerformanceIdTitleDto
{
private
String
performanceId
;
private
String
title
;
}
liquidnet-bus-do/liquidnet-service-adam-do/src/main/java/com/liquidnet/service/adam/mapper/AdamCaomeiBadgeMapper.java
View file @
9607bee7
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.adam.mapper;
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.adam.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.liquidnet.service.adam.dto.AdamCaomeiBadgeClaimCountDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiBadgeClaimCountDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiBadgeClaimUserDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiBadgeClaimUserDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiPerformanceIdTitleDto
;
import
com.liquidnet.service.adam.entity.AdamCaomeiBadge
;
import
com.liquidnet.service.adam.entity.AdamCaomeiBadge
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Delete
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Insert
;
...
@@ -107,4 +108,16 @@ public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
...
@@ -107,4 +108,16 @@ public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
@Select
(
"select title from kylin_performances where performances_id = #{performanceId}"
)
@Select
(
"select title from kylin_performances where performances_id = #{performanceId}"
)
String
selectKylinPerformanceTitleById
(
@Param
(
"performanceId"
)
String
performanceId
);
String
selectKylinPerformanceTitleById
(
@Param
(
"performanceId"
)
String
performanceId
);
@Select
({
"<script>"
,
"select performances_id as performanceId, title"
,
"from kylin_performances"
,
"where performances_id in"
,
"<foreach collection='performanceIds' item='performanceId' open='(' separator=',' close=')'>"
,
"#{performanceId}"
,
"</foreach>"
,
"</script>"
})
List
<
AdamCaomeiPerformanceIdTitleDto
>
selectKylinPerformanceTitlesByIds
(
@Param
(
"performanceIds"
)
List
<
String
>
performanceIds
);
}
}
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/AdamRdmService.java
View file @
9607bee7
...
@@ -12,6 +12,7 @@ import com.liquidnet.commons.lang.util.JsonUtils;
...
@@ -12,6 +12,7 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import
com.liquidnet.commons.lang.util.SensitizeUtil
;
import
com.liquidnet.commons.lang.util.SensitizeUtil
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto
;
import
com.liquidnet.service.adam.dto.AdamCaomeiPerformanceIdTitleDto
;
import
com.liquidnet.service.adam.dto.AdamUserInfoDto
;
import
com.liquidnet.service.adam.dto.AdamUserInfoDto
;
import
com.liquidnet.service.adam.dto.vo.*
;
import
com.liquidnet.service.adam.dto.vo.*
;
import
com.liquidnet.service.adam.entity.AdamCaomeiBadge
;
import
com.liquidnet.service.adam.entity.AdamCaomeiBadge
;
...
@@ -807,21 +808,62 @@ public class AdamRdmService {
...
@@ -807,21 +808,62 @@ public class AdamRdmService {
* 读取不到时返回 null。
* 读取不到时返回 null。
*/
*/
public
String
getPerformanceTitleById
(
String
performanceId
)
{
public
String
getPerformanceTitleById
(
String
performanceId
)
{
try
{
if
(
StringUtils
.
isEmpty
(
performanceId
))
{
KylinPerformanceVo
vo
=
getKylinPerformanceVoById
(
performanceId
);
return
null
;
if
(
vo
!=
null
)
{
}
return
vo
.
getTitle
();
String
id
=
performanceId
.
trim
();
Map
<
String
,
String
>
map
=
getPerformanceTitleMapByIds
(
Collections
.
singletonList
(
id
));
return
map
.
get
(
id
);
}
/**
* 批量解析演出 ID → 标题:先走 Kylin Redis,缓存未命中的 ID 合并为一次 DB IN 查询。
*/
public
Map
<
String
,
String
>
getPerformanceTitleMapByIds
(
Collection
<
String
>
performanceIds
)
{
if
(
CollectionUtils
.
isEmpty
(
performanceIds
))
{
return
Collections
.
emptyMap
();
}
List
<
String
>
ids
=
performanceIds
.
stream
()
.
filter
(
id
->
!
StringUtils
.
isEmpty
(
id
))
.
map
(
String:
:
trim
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
ids
.
isEmpty
())
{
return
Collections
.
emptyMap
();
}
Map
<
String
,
String
>
result
=
new
HashMap
<>(
ids
.
size
()
*
2
);
List
<
String
>
missingFromCache
=
new
ArrayList
<>();
for
(
String
id
:
ids
)
{
try
{
KylinPerformanceVo
vo
=
getKylinPerformanceVoById
(
id
);
if
(
vo
!=
null
)
{
String
title
=
vo
.
getTitle
();
if
(!
StringUtils
.
isEmpty
(
title
))
{
result
.
put
(
id
,
title
);
}
}
else
{
missingFromCache
.
add
(
id
);
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"[getPerformanceTitleMapByIds] 读取演出缓存失败, performanceId: {}"
,
id
,
e
);
missingFromCache
.
add
(
id
);
}
}
// 从数据库查询
}
String
title
=
adamCaomeiBadgeMapper
.
selectKylinPerformanceTitleById
(
performanceId
);
if
(!
StringUtils
.
isEmpty
(
title
))
{
if
(!
missingFromCache
.
isEmpty
())
{
return
title
;
List
<
AdamCaomeiPerformanceIdTitleDto
>
rows
=
adamCaomeiBadgeMapper
.
selectKylinPerformanceTitlesByIds
(
missingFromCache
);
if
(!
CollectionUtils
.
isEmpty
(
rows
))
{
for
(
AdamCaomeiPerformanceIdTitleDto
row
:
rows
)
{
if
(
row
==
null
||
StringUtils
.
isEmpty
(
row
.
getPerformanceId
())
||
StringUtils
.
isEmpty
(
row
.
getTitle
()))
{
continue
;
}
result
.
put
(
row
.
getPerformanceId
().
trim
(),
row
.
getTitle
());
}
}
}
return
null
;
}
catch
(
Exception
e
)
{
log
.
warn
(
"[getPerformanceTitleById] 读取演出缓存失败, performanceId: {}"
,
performanceId
,
e
);
return
null
;
}
}
return
result
;
}
}
/**
/**
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/impl/AdamCaomeiPassportUserServiceImpl.java
View file @
9607bee7
...
@@ -225,9 +225,14 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
...
@@ -225,9 +225,14 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
log
.
info
(
"[getPassportHome] 本次静默发放签证页后刷新用户徽章缓存, uid: {}"
,
uid
);
log
.
info
(
"[getPassportHome] 本次静默发放签证页后刷新用户徽章缓存, uid: {}"
,
uid
);
}
}
Map
<
String
,
String
>
claimedPerformanceTitleById
=
buildClaimedPerformanceTitleMap
(
rows
);
// 首页货架:排除 type=4
List
<
AdamCaomeiBadge
>
shelfPublished
=
filterShelfPublished
(
published
);
// 已领徽章 + 货架 type=2 的演出 ID 合并后批量解析名称,避免重复循环查库
Map
<
String
,
String
>
performanceTitleById
=
adamRdmService
.
getPerformanceTitleMapByIds
(
collectPerformanceIdsForTitleLookup
(
rows
,
shelfPublished
));
// 首页徽章墙:排除 type=4
// 首页徽章墙:排除 type=4
List
<
AdamCaomeiPassportUserClaimedBadgeVo
>
claimed
=
toClaimedBadgeVos
(
rows
,
claimedP
erformanceTitleById
).
stream
()
List
<
AdamCaomeiPassportUserClaimedBadgeVo
>
claimed
=
toClaimedBadgeVos
(
rows
,
p
erformanceTitleById
).
stream
()
.
filter
(
v
->
!
isVisaBadgeType
(
v
.
getType
()))
.
filter
(
v
->
!
isVisaBadgeType
(
v
.
getType
()))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
home
.
setClaimedBadges
(
claimed
);
home
.
setClaimedBadges
(
claimed
);
...
@@ -237,10 +242,6 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
...
@@ -237,10 +242,6 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
log
.
info
(
"[getPassportHome] 系统已上架的徽章数量, uid: {}, 数量: {}"
,
uid
,
published
.
size
());
log
.
info
(
"[getPassportHome] 系统已上架的徽章数量, uid: {}, 数量: {}"
,
uid
,
published
.
size
());
// 首页货架:排除 type=4,仅 type=2 需要演出名称
List
<
AdamCaomeiBadge
>
shelfPublished
=
filterShelfPublished
(
published
);
Map
<
String
,
String
>
performanceTitleById
=
buildPerformanceTitleMap
(
shelfPublished
);
List
<
AdamCaomeiPassportBadgeShelfItemVo
>
allBadges
=
toShelfItems
(
List
<
AdamCaomeiPassportBadgeShelfItemVo
>
allBadges
=
toShelfItems
(
shelfPublished
,
shelfPublished
,
claimedMap
,
claimedMap
,
...
@@ -275,11 +276,10 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
...
@@ -275,11 +276,10 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
return
ResponseDto
.
success
(
Collections
.
emptyList
());
return
ResponseDto
.
success
(
Collections
.
emptyList
());
}
}
Map
<
String
,
String
>
performanceTitleById
=
buildPerformanceTitleMapByPerf
Ids
(
Map
<
String
,
String
>
performanceTitleById
=
adamRdmService
.
getPerformanceTitleMapBy
Ids
(
visaRows
.
stream
()
visaRows
.
stream
()
.
map
(
AdamCaomeiPassportUserBadgeDto:
:
getPerformanceId
)
.
map
(
AdamCaomeiPassportUserBadgeDto:
:
getPerformanceId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
())
.
collect
(
Collectors
.
toList
())
);
);
...
@@ -381,71 +381,31 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
...
@@ -381,71 +381,31 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
}
}
private
Map
<
String
,
String
>
buildClaimedPerformanceTitleMap
(
List
<
AdamCaomeiPassportUserBadgeDto
>
claimedRows
)
{
List
<
String
>
perfIds
=
claimedRows
.
stream
()
.
filter
(
r
->
r
!=
null
&&
r
.
getType
()
!=
null
&&
r
.
getType
()
==
2
)
.
map
(
AdamCaomeiPassportUserBadgeDto:
:
getPerformanceId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
perfIds
.
isEmpty
())
{
return
Collections
.
emptyMap
();
}
Map
<
String
,
String
>
map
=
new
HashMap
<>(
perfIds
.
size
()
*
2
);
for
(
String
perfId
:
perfIds
)
{
String
title
=
adamRdmService
.
getPerformanceTitleById
(
perfId
);
if
(
StringUtils
.
isNotBlank
(
title
))
{
map
.
put
(
perfId
,
title
);
}
}
return
map
;
}
private
static
Map
<
String
,
AdamCaomeiPassportUserBadgeDto
>
toClaimedBadgeMap
(
List
<
AdamCaomeiPassportUserBadgeDto
>
rows
)
{
private
static
Map
<
String
,
AdamCaomeiPassportUserBadgeDto
>
toClaimedBadgeMap
(
List
<
AdamCaomeiPassportUserBadgeDto
>
rows
)
{
return
rows
.
stream
()
return
rows
.
stream
()
.
filter
(
r
->
StringUtils
.
isNotBlank
(
r
.
getBadgeId
()))
.
filter
(
r
->
StringUtils
.
isNotBlank
(
r
.
getBadgeId
()))
.
collect
(
Collectors
.
toMap
(
AdamCaomeiPassportUserBadgeDto:
:
getBadgeId
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
.
collect
(
Collectors
.
toMap
(
AdamCaomeiPassportUserBadgeDto:
:
getBadgeId
,
Function
.
identity
(),
(
a
,
b
)
->
a
));
}
}
private
Map
<
String
,
String
>
buildPerformanceTitleMap
(
List
<
AdamCaomeiBadge
>
published
)
{
/** 收集首页需展示演出名称的场次 ID(已领 type=2/4 + 货架 type=2) */
List
<
String
>
perfIds
=
published
.
stream
()
private
static
List
<
String
>
collectPerformanceIdsForTitleLookup
(
List
<
AdamCaomeiPassportUserBadgeDto
>
userRows
,
.
filter
(
b
->
b
!=
null
&&
b
.
getType
()
!=
null
&&
b
.
getType
()
==
2
)
List
<
AdamCaomeiBadge
>
shelfPublished
)
{
.
map
(
AdamCaomeiBadge:
:
getPerformanceId
)
Set
<
String
>
ids
=
new
LinkedHashSet
<>();
.
filter
(
StringUtils:
:
isNotBlank
)
if
(
userRows
!=
null
)
{
.
distinct
()
for
(
AdamCaomeiPassportUserBadgeDto
r
:
userRows
)
{
.
collect
(
Collectors
.
toList
());
if
(
r
!=
null
&&
needsPerformanceFields
(
r
.
getType
())
&&
StringUtils
.
isNotBlank
(
r
.
getPerformanceId
()))
{
if
(
perfIds
.
isEmpty
())
{
ids
.
add
(
r
.
getPerformanceId
().
trim
());
return
Collections
.
emptyMap
();
}
}
Map
<
String
,
String
>
map
=
new
HashMap
<>(
perfIds
.
size
()
*
2
);
for
(
String
perfId
:
perfIds
)
{
String
title
=
adamRdmService
.
getPerformanceTitleById
(
perfId
);
if
(
StringUtils
.
isNotBlank
(
title
))
{
map
.
put
(
perfId
,
title
);
}
}
}
}
return
map
;
if
(
shelfPublished
!=
null
)
{
}
for
(
AdamCaomeiBadge
b
:
shelfPublished
)
{
if
(
b
!=
null
&&
b
.
getType
()
!=
null
&&
b
.
getType
()
==
2
&&
StringUtils
.
isNotBlank
(
b
.
getPerformanceId
()))
{
/**
ids
.
add
(
b
.
getPerformanceId
().
trim
());
* 按演出 ID 批量解析名称(Kylin 演出缓存),供签证卡片等展示。
}
*/
private
Map
<
String
,
String
>
buildPerformanceTitleMapByPerfIds
(
List
<
String
>
perfIds
)
{
if
(
perfIds
==
null
||
perfIds
.
isEmpty
())
{
return
Collections
.
emptyMap
();
}
Map
<
String
,
String
>
map
=
new
HashMap
<>(
perfIds
.
size
()
*
2
);
for
(
String
perfId
:
perfIds
)
{
if
(
StringUtils
.
isBlank
(
perfId
))
{
continue
;
}
String
title
=
adamRdmService
.
getPerformanceTitleById
(
perfId
);
if
(
StringUtils
.
isNotBlank
(
title
))
{
map
.
put
(
perfId
,
title
);
}
}
}
}
return
map
;
return
new
ArrayList
<>(
ids
)
;
}
}
/**
/**
...
...
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