记得上下班打卡 | 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
6230abef
Commit
6230abef
authored
Apr 24, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同一演出仅需补签一次即可领取同场次所有徽章,审核也是
parent
75c196d8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
144 additions
and
38 deletions
+144
-38
AdamCaomeiBadgeUserServiceImpl.java
...ice/adam/service/impl/AdamCaomeiBadgeUserServiceImpl.java
+73
-16
AdamCaomeiPassportUserServiceImpl.java
.../adam/service/impl/AdamCaomeiPassportUserServiceImpl.java
+71
-22
No files found.
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/impl/AdamCaomeiBadgeUserServiceImpl.java
View file @
6230abef
package
com
.
liquidnet
.
service
.
adam
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.service.adam.dto.AdamCaomeiPassportUserBadgeDto
;
...
...
@@ -30,6 +31,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.stream.Collectors
;
@Slf4j
...
...
@@ -111,13 +113,19 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
String
idCard
=
real
.
getIdCard
();
List
<
String
>
paidPerformanceIds
=
adamRdmService
.
getPaidPerformanceIdsByIdCard
(
idCard
);
boolean
hasPaidRecord
=
paidPerformanceIds
!=
null
&&
paidPerformanceIds
.
contains
(
badge
.
getPerformanceId
());
Integer
passedApplyCount
=
badgeApplyRecordMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getBadgeId
,
badgeId
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getAuditStatus
,
1
)
);
boolean
hasPassedApply
=
passedApplyCount
!=
null
&&
passedApplyCount
>
0
;
String
perfId
=
StringUtils
.
trimToEmpty
(
badge
.
getPerformanceId
());
boolean
hasPassedApply
;
if
(
StringUtils
.
isNotBlank
(
perfId
))
{
hasPassedApply
=
countApplyForUserPerformanceAudit
(
uid
,
perfId
,
1
)
>
0
;
}
else
{
Integer
passedApplyCount
=
badgeApplyRecordMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getBadgeId
,
badgeId
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getAuditStatus
,
1
)
);
hasPassedApply
=
passedApplyCount
!=
null
&&
passedApplyCount
>
0
;
}
if
(!
hasPaidRecord
&&
!
hasPassedApply
)
{
log
.
error
(
"[claimBadge] 无购票记录且无通过的补签申请,无法认领, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
...
...
@@ -215,19 +223,25 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10608"
));
}
Integer
pendingCount
=
badgeApplyRecordMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getBadgeId
,
badgeId
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getAuditStatus
,
0
)
);
if
(
pendingCount
!=
null
&&
pendingCount
>
0
)
{
return
ResponseDto
.
failure
(
"您已有待审核的补签申请,请勿重复提交"
);
String
performanceId
=
StringUtils
.
trimToEmpty
(
badge
.
getPerformanceId
());
int
pendingApply
;
if
(
StringUtils
.
isNotBlank
(
performanceId
))
{
pendingApply
=
countApplyForUserPerformanceAudit
(
uid
,
performanceId
,
0
);
}
else
{
Integer
pendingCount
=
badgeApplyRecordMapper
.
selectCount
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getBadgeId
,
badgeId
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getAuditStatus
,
0
)
);
pendingApply
=
pendingCount
==
null
?
0
:
pendingCount
;
}
if
(
pendingApply
>
0
)
{
return
ResponseDto
.
failure
(
"该场次已有待审核的补签申请,请勿重复提交"
);
}
final
String
applyRecordId
=
IDGenerator
.
nextSnowId
();
long
t
=
System
.
currentTimeMillis
();
String
performanceId
=
StringUtils
.
trimToEmpty
(
badge
.
getPerformanceId
());
boolean
autoPass
=
isPerformanceOngoing
(
performanceId
);
if
(
autoPass
)
{
// 与 admin 审核通过保持一致:仅将申请记录标记为已通过,不自动发放徽章
...
...
@@ -256,6 +270,49 @@ public class AdamCaomeiBadgeUserServiceImpl implements IAdamCaomeiBadgeUserServi
return
ResponseDto
.
success
(
applyRecordId
);
}
/**
* 同场次 type=2 徽章 ID(用于补签记录 performance_id 为空等历史数据的 OR 查询)。
*/
private
Set
<
String
>
type2BadgeIdsForPerformance
(
String
performanceId
)
{
if
(
StringUtils
.
isBlank
(
performanceId
))
{
return
Collections
.
emptySet
();
}
List
<
AdamCaomeiBadge
>
list
=
adamCaomeiBadgeMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadge
.
class
)
.
eq
(
AdamCaomeiBadge:
:
getType
,
2
)
.
eq
(
AdamCaomeiBadge:
:
getPerformanceId
,
performanceId
));
if
(
list
==
null
||
list
.
isEmpty
())
{
return
Collections
.
emptySet
();
}
return
list
.
stream
()
.
map
(
AdamCaomeiBadge:
:
getBadgeId
)
.
filter
(
StringUtils:
:
isNotBlank
)
.
collect
(
Collectors
.
toSet
());
}
/**
* 用户对某场次是否存在指定审核状态的补签记录(按 performance_id 或同场徽章 ID 命中)。
*/
private
int
countApplyForUserPerformanceAudit
(
String
uid
,
String
performanceId
,
int
auditStatus
)
{
if
(
StringUtils
.
isBlank
(
performanceId
))
{
return
0
;
}
Set
<
String
>
samePerfBadgeIds
=
type2BadgeIdsForPerformance
(
performanceId
);
LambdaQueryWrapper
<
AdamCaomeiBadgeApplyRecord
>
qw
=
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getAuditStatus
,
auditStatus
);
if
(
samePerfBadgeIds
.
isEmpty
())
{
qw
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getPerformanceId
,
performanceId
);
}
else
{
qw
.
and
(
w
->
w
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getPerformanceId
,
performanceId
)
.
or
()
.
in
(
AdamCaomeiBadgeApplyRecord:
:
getBadgeId
,
samePerfBadgeIds
));
}
Integer
n
=
badgeApplyRecordMapper
.
selectCount
(
qw
);
return
n
==
null
?
0
:
n
;
}
private
boolean
isPerformanceOngoing
(
String
performanceId
)
{
if
(
StringUtils
.
isBlank
(
performanceId
))
{
return
false
;
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/impl/AdamCaomeiPassportUserServiceImpl.java
View file @
6230abef
...
...
@@ -194,7 +194,12 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
:
new
ArrayList
<>();
log
.
info
(
"[getPassportHome] 用户已支付的演出订单数量, uid: {}, 数量: {}"
,
uid
,
paidPerformanceIds
.
size
());
ApplyBadgeStatus
applyBadgeStatus
=
loadApplyBadgeStatus
(
uid
);
// 先取上架徽章配置(供补签状态按演出聚合时做 badgeId→performanceId 兜底)
List
<
AdamCaomeiBadge
>
published
=
adamRdmService
.
getPublishedCaomeiBadges
();
if
(
published
==
null
)
{
published
=
new
ArrayList
<>();
}
ApplyBadgeStatus
applyBadgeStatus
=
loadApplyBadgeStatus
(
uid
,
published
);
// 6. 查询用户已认领的所有徽章记录 (用于展示徽章墙)
List
<
AdamCaomeiPassportUserBadgeDto
>
rows
=
adamRdmService
.
getUserCaomeiBadgesByUid
(
uid
);
...
...
@@ -209,11 +214,6 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
// 转换为 Map 方便后续匹配货架上的徽章是否已认领
Map
<
String
,
AdamCaomeiPassportUserBadgeDto
>
claimedMap
=
toClaimedBadgeMap
(
rows
);
// 7. 查询所有已上架的徽章配置,并按类型升序、排序值降序、ID降序排序
List
<
AdamCaomeiBadge
>
published
=
adamRdmService
.
getPublishedCaomeiBadges
();
if
(
published
==
null
)
{
published
=
new
ArrayList
<>();
}
log
.
info
(
"[getPassportHome] 系统已上架的徽章数量, uid: {}, 数量: {}"
,
uid
,
published
.
size
());
// 演出纪念徽章:批量查演出名称,供前端按演出分组展示
...
...
@@ -224,8 +224,7 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
published
,
claimedMap
,
paidPerformanceIds
,
applyBadgeStatus
.
passedApplyBadgeIds
,
applyBadgeStatus
.
pendingApplyBadgeIds
,
applyBadgeStatus
,
performanceTitleById
);
...
...
@@ -258,7 +257,15 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
return
card
;
}
private
ApplyBadgeStatus
loadApplyBadgeStatus
(
String
uid
)
{
private
ApplyBadgeStatus
loadApplyBadgeStatus
(
String
uid
,
List
<
AdamCaomeiBadge
>
published
)
{
Map
<
String
,
String
>
badgeIdToPerformanceId
=
new
HashMap
<>();
if
(
published
!=
null
)
{
for
(
AdamCaomeiBadge
b
:
published
)
{
if
(
b
!=
null
&&
StringUtils
.
isNotBlank
(
b
.
getBadgeId
()))
{
badgeIdToPerformanceId
.
put
(
b
.
getBadgeId
(),
StringUtils
.
trimToEmpty
(
b
.
getPerformanceId
()));
}
}
}
List
<
AdamCaomeiBadgeApplyRecord
>
applyRecords
=
badgeApplyRecordMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadgeApplyRecord
.
class
)
.
eq
(
AdamCaomeiBadgeApplyRecord:
:
getUserId
,
uid
)
...
...
@@ -266,17 +273,34 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
);
Set
<
String
>
passedApplyBadgeIds
=
new
HashSet
<>();
Set
<
String
>
pendingApplyBadgeIds
=
new
HashSet
<>();
Set
<
String
>
passedApplyPerformanceIds
=
new
HashSet
<>();
Set
<
String
>
pendingApplyPerformanceIds
=
new
HashSet
<>();
for
(
AdamCaomeiBadgeApplyRecord
r
:
applyRecords
)
{
if
(
r
==
null
||
StringUtils
.
isBlank
(
r
.
getBadgeId
())
||
r
.
getAuditStatus
()
==
null
)
{
continue
;
}
String
perf
=
StringUtils
.
trimToEmpty
(
r
.
getPerformanceId
());
if
(
StringUtils
.
isBlank
(
perf
))
{
perf
=
StringUtils
.
trimToEmpty
(
badgeIdToPerformanceId
.
get
(
r
.
getBadgeId
()));
}
if
(
r
.
getAuditStatus
()
==
1
)
{
passedApplyBadgeIds
.
add
(
r
.
getBadgeId
());
if
(
StringUtils
.
isNotBlank
(
perf
))
{
passedApplyPerformanceIds
.
add
(
perf
);
}
}
else
if
(
r
.
getAuditStatus
()
==
0
)
{
pendingApplyBadgeIds
.
add
(
r
.
getBadgeId
());
if
(
StringUtils
.
isNotBlank
(
perf
))
{
pendingApplyPerformanceIds
.
add
(
perf
);
}
}
}
return
new
ApplyBadgeStatus
(
passedApplyBadgeIds
,
pendingApplyBadgeIds
);
return
new
ApplyBadgeStatus
(
passedApplyBadgeIds
,
pendingApplyBadgeIds
,
passedApplyPerformanceIds
,
pendingApplyPerformanceIds
);
}
private
static
List
<
AdamCaomeiPassportUserClaimedBadgeVo
>
toClaimedBadgeVos
(
List
<
AdamCaomeiPassportUserBadgeDto
>
rows
,
...
...
@@ -351,11 +375,10 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
private
static
List
<
AdamCaomeiPassportBadgeShelfItemVo
>
toShelfItems
(
List
<
AdamCaomeiBadge
>
published
,
Map
<
String
,
AdamCaomeiPassportUserBadgeDto
>
claimedMap
,
List
<
String
>
paidPerformanceIds
,
Set
<
String
>
passedApplyBadgeIds
,
Set
<
String
>
pendingApplyBadgeIds
,
ApplyBadgeStatus
applyBadgeStatus
,
Map
<
String
,
String
>
performanceTitleById
)
{
return
published
.
stream
()
.
map
(
b
->
toShelfItem
(
b
,
claimedMap
,
paidPerformanceIds
,
passedApplyBadgeIds
,
pendingApplyBadgeId
s
,
performanceTitleById
))
.
map
(
b
->
toShelfItem
(
b
,
claimedMap
,
paidPerformanceIds
,
applyBadgeStatu
s
,
performanceTitleById
))
.
collect
(
Collectors
.
toList
());
}
...
...
@@ -363,16 +386,14 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
* @param b 徽章信息
* @param claimedMap 用户已领取的徽章
* @param paidPerformanceIds 当前账号实名身份证号码购买的演出IDs
* @param passedApplyBadgeIds 补签审核已通过的徽章ID集合
* @param pendingApplyBadgeIds 补签待审核的徽章ID集合
* @param applyBadgeStatus 补签审核状态(按徽章 + 按同场次演出聚合)
* @param performanceTitleById 演出 ID → 演出名称(仅 type=2 使用)
* @return
*/
private
static
AdamCaomeiPassportBadgeShelfItemVo
toShelfItem
(
AdamCaomeiBadge
b
,
Map
<
String
,
AdamCaomeiPassportUserBadgeDto
>
claimedMap
,
List
<
String
>
paidPerformanceIds
,
Set
<
String
>
passedApplyBadgeIds
,
Set
<
String
>
pendingApplyBadgeIds
,
ApplyBadgeStatus
applyBadgeStatus
,
Map
<
String
,
String
>
performanceTitleById
)
{
AdamCaomeiPassportBadgeShelfItemVo
v
=
new
AdamCaomeiPassportBadgeShelfItemVo
();
v
.
setBadgeId
(
b
.
getBadgeId
());
...
...
@@ -402,11 +423,16 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
// 护照纪念徽章:只要绑定了护照,就可认领(通常是绑定时漏发或后来新上架的)
v
.
setClaimable
(
true
);
}
else
if
(
type
==
2
)
{
// 演出纪念徽章:有购票记录
或补签审核通过即
可认领
// 演出纪念徽章:有购票记录
,或本场次任一补签审核通过,则本场次关联徽章均
可认领
boolean
canClaimByPaid
=
paidPerformanceIds
!=
null
&&
paidPerformanceIds
.
contains
(
b
.
getPerformanceId
());
boolean
canClaimByApply
=
passedApplyBadgeIds
!=
null
&&
passedApplyBadgeIds
.
contains
(
b
.
getBadgeId
());
v
.
setClaimable
(
canClaimByPaid
||
canClaimByApply
);
v
.
setApplyPending
(
pendingApplyBadgeIds
!=
null
&&
pendingApplyBadgeIds
.
contains
(
b
.
getBadgeId
()));
boolean
canClaimByApplyThisBadge
=
applyBadgeStatus
.
getPassedApplyBadgeIds
().
contains
(
b
.
getBadgeId
());
boolean
canClaimByApplyThisPerf
=
StringUtils
.
isNotBlank
(
perfId
)
&&
applyBadgeStatus
.
getPassedApplyPerformanceIds
().
contains
(
perfId
);
v
.
setClaimable
(
canClaimByPaid
||
canClaimByApplyThisBadge
||
canClaimByApplyThisPerf
);
boolean
pendingThisBadge
=
applyBadgeStatus
.
getPendingApplyBadgeIds
().
contains
(
b
.
getBadgeId
());
boolean
pendingThisPerf
=
StringUtils
.
isNotBlank
(
perfId
)
&&
applyBadgeStatus
.
getPendingApplyPerformanceIds
().
contains
(
perfId
);
v
.
setApplyPending
(
pendingThisBadge
||
pendingThisPerf
);
}
else
if
(
type
==
3
)
{
// 特殊徽章:不可自助领取,需要提示用户
v
.
setClaimable
(
false
);
...
...
@@ -433,10 +459,33 @@ public class AdamCaomeiPassportUserServiceImpl implements IAdamCaomeiPassportUse
private
static
final
class
ApplyBadgeStatus
{
private
final
Set
<
String
>
passedApplyBadgeIds
;
private
final
Set
<
String
>
pendingApplyBadgeIds
;
private
final
Set
<
String
>
passedApplyPerformanceIds
;
private
final
Set
<
String
>
pendingApplyPerformanceIds
;
private
ApplyBadgeStatus
(
Set
<
String
>
passedApplyBadgeIds
,
Set
<
String
>
pendingApplyBadgeIds
)
{
private
ApplyBadgeStatus
(
Set
<
String
>
passedApplyBadgeIds
,
Set
<
String
>
pendingApplyBadgeIds
,
Set
<
String
>
passedApplyPerformanceIds
,
Set
<
String
>
pendingApplyPerformanceIds
)
{
this
.
passedApplyBadgeIds
=
passedApplyBadgeIds
;
this
.
pendingApplyBadgeIds
=
pendingApplyBadgeIds
;
this
.
passedApplyPerformanceIds
=
passedApplyPerformanceIds
;
this
.
pendingApplyPerformanceIds
=
pendingApplyPerformanceIds
;
}
Set
<
String
>
getPassedApplyBadgeIds
()
{
return
passedApplyBadgeIds
;
}
Set
<
String
>
getPendingApplyBadgeIds
()
{
return
pendingApplyBadgeIds
;
}
Set
<
String
>
getPassedApplyPerformanceIds
()
{
return
passedApplyPerformanceIds
;
}
Set
<
String
>
getPendingApplyPerformanceIds
()
{
return
pendingApplyPerformanceIds
;
}
}
}
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