记得上下班打卡 | 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
1c969740
Commit
1c969740
authored
Apr 16, 2026
by
wangyifan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草莓护照-用户端 认领徽章
parent
fc323e8b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
203 additions
and
0 deletions
+203
-0
AdamCaomeiBadgeClaimParam.java
...net/service/adam/dto/param/AdamCaomeiBadgeClaimParam.java
+16
-0
IAdamCaomeiBadgeUserService.java
...net/service/adam/service/IAdamCaomeiBadgeUserService.java
+14
-0
AdamCaomeiBadgeMapper.java
.../liquidnet/service/adam/mapper/AdamCaomeiBadgeMapper.java
+9
-0
AdamCaomeiBadgeUserController.java
...ervice/adam/controller/AdamCaomeiBadgeUserController.java
+39
-0
AdamCaomeiBadgeUserServiceImpl.java
...ice/adam/service/impl/AdamCaomeiBadgeUserServiceImpl.java
+118
-0
errors.properties
...et-service-adam-impl/src/main/resources/errors.properties
+7
-0
No files found.
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/dto/param/AdamCaomeiBadgeClaimParam.java
0 → 100644
View file @
1c969740
package
com
.
liquidnet
.
service
.
adam
.
dto
.
param
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
@Data
@ApiModel
(
"草莓徽章-认领参数"
)
public
class
AdamCaomeiBadgeClaimParam
{
@NotBlank
(
message
=
"徽章ID不能为空"
)
@ApiModelProperty
(
value
=
"徽章ID"
,
required
=
true
)
private
String
badgeId
;
}
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/service/IAdamCaomeiBadgeUserService.java
0 → 100644
View file @
1c969740
package
com
.
liquidnet
.
service
.
adam
.
service
;
import
com.liquidnet.service.base.ResponseDto
;
/**
* 草莓徽章(用户端)
*/
public
interface
IAdamCaomeiBadgeUserService
{
/**
* 认领徽章
*/
ResponseDto
<
String
>
claimBadge
(
String
badgeId
,
String
uid
);
}
liquidnet-bus-do/liquidnet-service-adam-do/src/main/java/com/liquidnet/service/adam/mapper/AdamCaomeiBadgeMapper.java
View file @
1c969740
...
@@ -69,4 +69,13 @@ public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
...
@@ -69,4 +69,13 @@ public interface AdamCaomeiBadgeMapper extends BaseMapper<AdamCaomeiBadge> {
"where enter_id_code = #{idCard} and is_payment = 1"
"where enter_id_code = #{idCard} and is_payment = 1"
})
})
List
<
String
>
selectPaidPerformanceIdsByIdCard
(
@Param
(
"idCard"
)
String
idCard
);
List
<
String
>
selectPaidPerformanceIdsByIdCard
(
@Param
(
"idCard"
)
String
idCard
);
@Select
(
"select count(1) from adam_caomei_user_badge where user_id = #{userId} and badge_id = #{badgeId}"
)
int
checkUserBadgeExists
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"badgeId"
)
String
badgeId
);
@Insert
({
"insert into adam_caomei_user_badge (user_id, badge_id, source, created_at) "
,
"values (#{userId}, #{badgeId}, #{source}, now())"
})
int
insertUserBadge
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"badgeId"
)
String
badgeId
,
@Param
(
"source"
)
Integer
source
);
}
}
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/controller/AdamCaomeiBadgeUserController.java
0 → 100644
View file @
1c969740
package
com
.
liquidnet
.
service
.
adam
.
controller
;
import
com.github.xiaoymin.knife4j.annotations.ApiOperationSupport
;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
com.liquidnet.commons.lang.util.CurrentUtil
;
import
com.liquidnet.service.adam.dto.param.AdamCaomeiBadgeClaimParam
;
import
com.liquidnet.service.adam.service.IAdamCaomeiBadgeUserService
;
import
com.liquidnet.service.base.ResponseDto
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
@ApiSupport
(
order
=
10046
)
@Api
(
tags
=
"草莓徽章(用户端)"
)
@Slf4j
@Validated
@RestController
@RequestMapping
(
"caomei/badge"
)
public
class
AdamCaomeiBadgeUserController
{
@Autowired
private
IAdamCaomeiBadgeUserService
adamCaomeiBadgeUserService
;
@ApiOperationSupport
(
order
=
1
)
@ApiOperation
(
"认领徽章"
)
@PostMapping
(
"claim"
)
public
ResponseDto
<
String
>
claim
(
@Valid
@RequestBody
AdamCaomeiBadgeClaimParam
param
)
{
String
uid
=
CurrentUtil
.
getCurrentUid
();
return
adamCaomeiBadgeUserService
.
claimBadge
(
param
.
getBadgeId
(),
uid
);
}
}
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/impl/AdamCaomeiBadgeUserServiceImpl.java
0 → 100644
View file @
1c969740
package
com
.
liquidnet
.
service
.
adam
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.liquidnet.service.adam.dto.vo.AdamRealInfoVo
;
import
com.liquidnet.service.adam.entity.AdamCaomeiBadge
;
import
com.liquidnet.service.adam.entity.AdamCaomeiPassport
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiPassportMapper
;
import
com.liquidnet.service.adam.service.AdamRdmService
;
import
com.liquidnet.service.adam.service.IAdamCaomeiBadgeUserService
;
import
com.liquidnet.service.base.ErrorMapping
;
import
com.liquidnet.service.base.ResponseDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Slf4j
@Service
public
class
AdamCaomeiBadgeUserServiceImpl
implements
IAdamCaomeiBadgeUserService
{
@Autowired
private
AdamCaomeiBadgeMapper
adamCaomeiBadgeMapper
;
@Autowired
private
AdamCaomeiPassportMapper
adamCaomeiPassportMapper
;
@Autowired
private
AdamRdmService
adamRdmService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseDto
<
String
>
claimBadge
(
String
badgeId
,
String
uid
)
{
if
(
StringUtils
.
isBlank
(
uid
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10001"
));
}
// 1. 查询徽章配置
AdamCaomeiBadge
badge
=
adamCaomeiBadgeMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
AdamCaomeiBadge
.
class
)
.
eq
(
AdamCaomeiBadge:
:
getBadgeId
,
badgeId
)
.
eq
(
AdamCaomeiBadge:
:
getDisplayStatus
,
1
)
);
if
(
badge
==
null
)
{
log
.
error
(
"[claimBadge] 徽章不存在或未上架, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10607"
));
}
// 2. 检查用户是否已经领取过该徽章
int
count
=
adamCaomeiBadgeMapper
.
checkUserBadgeExists
(
uid
,
badgeId
);
if
(
count
>
0
)
{
log
.
info
(
"[claimBadge] 用户已领取过该徽章, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10608"
));
}
int
type
=
badge
.
getType
()
==
null
?
0
:
badge
.
getType
();
// 3. 根据徽章类型执行不同的认领逻辑
if
(
type
==
1
)
{
// 护照纪念徽章:需要绑定了护照才能领取
AdamCaomeiPassport
bound
=
adamCaomeiPassportMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
AdamCaomeiPassport
.
class
)
.
eq
(
AdamCaomeiPassport:
:
getUserId
,
uid
)
.
eq
(
AdamCaomeiPassport:
:
getStatus
,
1
)
.
last
(
"limit 1"
)
);
if
(
bound
==
null
)
{
log
.
error
(
"[claimBadge] 认领护照纪念徽章需先绑定护照, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10609"
));
}
// 发放徽章 (source: 1-绑定护照自动发放/护照徽章认领)
adamCaomeiBadgeMapper
.
insertUserBadge
(
uid
,
badgeId
,
1
);
log
.
info
(
"[claimBadge] 护照纪念徽章认领成功, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
success
(
badgeId
);
}
else
if
(
type
==
2
)
{
// 演出纪念徽章:需要实名认证 + 购票记录
AdamRealInfoVo
real
=
adamRdmService
.
getRealInfoVoByUidPlain
(
uid
);
if
(
real
==
null
||
real
.
getState
()
==
null
||
real
.
getState
()
!=
1
||
StringUtils
.
isBlank
(
real
.
getIdCard
()))
{
log
.
error
(
"[claimBadge] 认领演出徽章需先实名, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10610"
));
}
String
idCard
=
real
.
getIdCard
();
List
<
String
>
paidPerformanceIds
=
adamCaomeiBadgeMapper
.
selectPaidPerformanceIdsByIdCard
(
idCard
);
if
(
paidPerformanceIds
==
null
||
!
paidPerformanceIds
.
contains
(
badge
.
getPerformanceId
()))
{
log
.
error
(
"[claimBadge] 未查询到该演出的购票记录,无法认领, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10611"
));
}
// 自动发放该演出所有关联徽章
// List<AdamCaomeiBadge> performanceBadges = adamCaomeiBadgeMapper.selectList(
// Wrappers.lambdaQuery(AdamCaomeiBadge.class)
// .eq(AdamCaomeiBadge::getPerformanceId, badge.getPerformanceId())
// .eq(AdamCaomeiBadge::getDisplayStatus, 1)
// .eq(AdamCaomeiBadge::getType, 2)
// );
// for (AdamCaomeiBadge perfBadge : performanceBadges) {
// 发放徽章 (source: 2-购票自动发放/演出徽章认领)
adamCaomeiBadgeMapper
.
insertUserBadge
(
uid
,
badgeId
,
2
);
// }
log
.
info
(
"[claimBadge] 演出纪念徽章认领成功, uid: {}, badgeId: {}, 发放数量: {}"
,
uid
,
badgeId
,
1
);
return
ResponseDto
.
success
(
badgeId
);
}
else
if
(
type
==
3
)
{
// 特殊徽章不可自助领取
log
.
error
(
"[claimBadge] 特殊徽章不可自助领取, uid: {}, badgeId: {}"
,
uid
,
badgeId
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10612"
));
}
log
.
error
(
"[claimBadge] 未知的徽章类型, uid: {}, badgeId: {}, type: {}"
,
uid
,
badgeId
,
type
);
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10613"
));
}
}
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/resources/errors.properties
View file @
1c969740
...
@@ -94,6 +94,13 @@
...
@@ -94,6 +94,13 @@
10604
=
\u
62A4
\u7167\u
7F16
\u
53F7
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
10604
=
\u
62A4
\u7167\u
7F16
\u
53F7
\u
4E0D
\u
80FD
\u
4E3A
\u
7A7A
10605
=
\u
62A4
\u7167\u
7ED1
\u
5B9A
\u5931\u
8D25
\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
91CD
\u
8BD5
10605
=
\u
62A4
\u7167\u
7ED1
\u
5B9A
\u5931\u
8D25
\u
FF0C
\u
8BF7
\u
7A0D
\u
540E
\u
91CD
\u
8BD5
10606
=
\u
8BE5
\u
62A4
\u7167\u
5DF2
\u
4E0E
\u
60A8
\u
7ED1
\u
5B9A
\u
FF0C
\u
65E0
\u9700\u
91CD
\u
590D
\u
64CD
\u
4F5C
10606
=
\u
8BE5
\u
62A4
\u7167\u
5DF2
\u
4E0E
\u
60A8
\u
7ED1
\u
5B9A
\u
FF0C
\u
65E0
\u9700\u
91CD
\u
590D
\u
64CD
\u
4F5C
10607
=
\u
5FBD
\u
7AE0
\u
4E0D
\u
5B58
\u5728\u6216\u
672A
\u
4E0A
\u
67B6
10608
=
\u
60A8
\u
5DF2
\u9886\u
53D6
\u
8FC7
\u
8BE5
\u
5FBD
\u
7AE0
10609
=
\u
8BA4
\u9886\u
62A4
\u7167\u
7EAA
\u
5FF5
\u
5FBD
\u
7AE0
\u9700\u5148\u
7ED1
\u
5B9A
\u
62A4
\u7167
10610
=
\u
8BA4
\u9886\u
6F14
\u
51FA
\u
5FBD
\u
7AE0
\u9700\u5148\u
5B9E
\u
540D
10611
=
\u
672A
\u
67E5
\u
8BE2
\u5230\u
8BE5
\u
6F14
\u
51FA
\u7684\u
8D2D
\u7968\u
8BB0
\u
5F55
\u
FF0C
\u
65E0
\u
6CD5
\u
8BA4
\u9886
10612
=
\u7279\u
6B8A
\u
5FBD
\u
7AE0
\u
4E0D
\u
53EF
\u
81EA
\u
52A9
\u9886\u
53D6
10613
=
\u
672A
\u
77E5
\u7684\u
5FBD
\u
7AE0
\u
7C7B
\u
578B
...
...
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