记得上下班打卡 | 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
e4a49505
Commit
e4a49505
authored
Apr 23, 2026
by
姜秀龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一个身份证只能绑定一个账号,100031
parent
fac85886
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
11 deletions
+86
-11
AdamRedisConst.java
...a/com/liquidnet/service/adam/constant/AdamRedisConst.java
+6
-0
AdamUserController.java
...liquidnet/service/adam/controller/AdamUserController.java
+30
-11
AdamRdmService.java
...va/com/liquidnet/service/adam/service/AdamRdmService.java
+49
-0
errors.properties
...et-service-adam-impl/src/main/resources/errors.properties
+1
-0
No files found.
liquidnet-bus-api/liquidnet-service-adam-api/src/main/java/com/liquidnet/service/adam/constant/AdamRedisConst.java
View file @
e4a49505
...
@@ -42,6 +42,12 @@ public class AdamRedisConst {
...
@@ -42,6 +42,12 @@ public class AdamRedisConst {
*/
*/
public
static
final
String
INFO_CERTIFICATION_JUNK
=
PREFIX
.
concat
(
"info:certification_junk:"
);
public
static
final
String
INFO_CERTIFICATION_JUNK
=
PREFIX
.
concat
(
"info:certification_junk:"
);
/**
* 身份证号 -> 已绑定实名的 uid(用于快速判重:同一身份证只能实名一个账号)
* value: uid(String)
*/
public
static
final
String
INFO_REAL_NAME_UID_BY_IDCARD
=
PREFIX
.
concat
(
"info:real_name:uid_by_idcard:"
);
public
static
final
String
INFO_MEMBER_JOINUS
=
PREFIX
.
concat
(
"info:member:joinus:"
);
public
static
final
String
INFO_MEMBER_JOINUS
=
PREFIX
.
concat
(
"info:member:joinus:"
);
public
static
final
String
INFO_MEMBER_SIMPLE
=
PREFIX
.
concat
(
"info:member:simple"
);
public
static
final
String
INFO_MEMBER_SIMPLE
=
PREFIX
.
concat
(
"info:member:simple"
);
public
static
final
String
INFO_MEMBER_CATEGORY
=
PREFIX
.
concat
(
"info:member:category:"
);
public
static
final
String
INFO_MEMBER_CATEGORY
=
PREFIX
.
concat
(
"info:member:category:"
);
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/controller/AdamUserController.java
View file @
e4a49505
...
@@ -300,16 +300,15 @@ public class AdamUserController {
...
@@ -300,16 +300,15 @@ public class AdamUserController {
}
}
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
String
currentUid
=
CurrentUtil
.
getCurrentUid
();
AdamRealInfoVo
realInfoVoByUid
=
adamRdmService
.
getRealInfoVoByUidPlain
(
currentUid
);
AdamRealInfoVo
realInfoVoByUid
=
adamRdmService
.
getRealInfoVoByUidPlain
(
currentUid
);
// 已实名 && 三要素通过
// 已实名:无论二要素(node=2)还是三要素(node=3),都视为已完成实名,直接返回(避免重复实名/跨入口重复认证)
if
(
null
!=
realInfoVoByUid
&&
realInfoVoByUid
.
getNode
()
==
3
)
{
if
(
null
!=
realInfoVoByUid
&&
realInfoVoByUid
.
getState
()
!=
null
&&
realInfoVoByUid
.
getState
()
==
1
)
{
// 用户输入信息与三要素通过的信息相符,则认证通过
realInfoVoByUid
.
setName
(
SensitizeUtil
.
chineseName
(
realInfoVoByUid
.
getName
()));
if
((
realInfoVoByUid
.
getName
().
concat
(
realInfoVoByUid
.
getIdCard
())).
equals
(
name
.
concat
(
idCard
)))
{
realInfoVoByUid
.
setIdCard
(
SensitizeUtil
.
custom
(
realInfoVoByUid
.
getIdCard
(),
3
,
2
));
realInfoVoByUid
.
setName
(
SensitizeUtil
.
chineseName
(
realInfoVoByUid
.
getName
()));
return
ResponseDto
.
success
(
realInfoVoByUid
);
realInfoVoByUid
.
setIdCard
(
SensitizeUtil
.
custom
(
realInfoVoByUid
.
getIdCard
(),
3
,
2
));
}
return
ResponseDto
.
success
(
realInfoVoByUid
);
ResponseDto
<
AdamRealInfoVo
>
guard
=
guardIdCardNotBoundToOtherUid
(
currentUid
,
idCard
);
}
else
{
if
(
guard
!=
null
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10113"
));
return
guard
;
}
}
}
AdamRealInfoVo
vo
=
adamUserService
.
identityForUpsert
(
currentUid
,
name
,
idCard
,
(
String
)
CurrentUtil
.
getTokenClaims
().
get
(
CurrentUtil
.
TOKEN_MOBILE
),
true
);
AdamRealInfoVo
vo
=
adamUserService
.
identityForUpsert
(
currentUid
,
name
,
idCard
,
(
String
)
CurrentUtil
.
getTokenClaims
().
get
(
CurrentUtil
.
TOKEN_MOBILE
),
true
);
vo
.
setName
(
SensitizeUtil
.
chineseName
(
vo
.
getName
()));
vo
.
setName
(
SensitizeUtil
.
chineseName
(
vo
.
getName
()));
...
@@ -504,7 +503,8 @@ public class AdamUserController {
...
@@ -504,7 +503,8 @@ public class AdamUserController {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10114"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10114"
));
}
}
AdamRealInfoVo
realInfoVoByUidPlain
=
adamRdmService
.
getRealInfoVoByUidPlain
(
uid
);
AdamRealInfoVo
realInfoVoByUidPlain
=
adamRdmService
.
getRealInfoVoByUidPlain
(
uid
);
if
(
null
==
realInfoVoByUidPlain
||
3
!=
realInfoVoByUidPlain
.
getNode
())
{
// 已实名:兼容二要素(node=2) 与 三要素(node=3),统一以 state=1 为准
if
(
null
==
realInfoVoByUidPlain
||
realInfoVoByUidPlain
.
getState
()
==
null
||
realInfoVoByUidPlain
.
getState
()
!=
1
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10115"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10115"
));
}
}
AdamUserIdentityInfoVo
userIdentityInfoVo
=
AdamUserIdentityInfoVo
.
getNew
();
AdamUserIdentityInfoVo
userIdentityInfoVo
=
AdamUserIdentityInfoVo
.
getNew
();
...
@@ -590,6 +590,10 @@ public class AdamUserController {
...
@@ -590,6 +590,10 @@ public class AdamUserController {
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10104"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10104"
));
}
}
ResponseDto
<
AdamRealInfoVo
>
guard
=
guardIdCardNotBoundToOtherUid
(
currentUid
,
idCard
);
if
(
guard
!=
null
)
{
return
guard
;
}
AdamRealInfoVo
vo
=
adamUserService
.
verifyTwoElements
(
currentUid
,
name
,
idCard
);
AdamRealInfoVo
vo
=
adamUserService
.
verifyTwoElements
(
currentUid
,
name
,
idCard
);
if
(
null
==
vo
)
{
if
(
null
==
vo
)
{
log
.
error
(
"[identityV2] 二要素认证失败, param: {}"
,
JsonUtils
.
toJson
(
param
));
log
.
error
(
"[identityV2] 二要素认证失败, param: {}"
,
JsonUtils
.
toJson
(
param
));
...
@@ -601,6 +605,21 @@ public class AdamUserController {
...
@@ -601,6 +605,21 @@ public class AdamUserController {
}
}
/**
* 同一个身份证号(state=1)只能绑定一个账号。
* 放在 controller 层:对所有实名入口统一拦截,返回明确错误码给前端。
*/
private
ResponseDto
<
AdamRealInfoVo
>
guardIdCardNotBoundToOtherUid
(
String
uid
,
String
idCard
)
{
if
(
StringUtils
.
isBlank
(
uid
)
||
StringUtils
.
isBlank
(
idCard
))
{
return
null
;
}
String
boundUid
=
adamRdmService
.
getRealNameBoundUidByIdCard
(
idCard
);
if
(
StringUtils
.
isNotBlank
(
boundUid
)
&&
!
uid
.
equals
(
boundUid
))
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"10614"
));
}
return
null
;
}
/* ---------------------------- Internal Method ---------------------------- */
/* ---------------------------- Internal Method ---------------------------- */
private
static
final
String
PHP_API_SMS_CODE_VALID
=
"/smsValidation"
;
private
static
final
String
PHP_API_SMS_CODE_VALID
=
"/smsValidation"
;
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/java/com/liquidnet/service/adam/service/AdamRdmService.java
View file @
e4a49505
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.adam.service;
...
@@ -2,6 +2,7 @@ package com.liquidnet.service.adam.service;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisDataSourceUtil
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
...
@@ -15,12 +16,14 @@ import com.liquidnet.service.adam.dto.AdamUserInfoDto;
...
@@ -15,12 +16,14 @@ 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
;
import
com.liquidnet.service.adam.entity.AdamEnters
;
import
com.liquidnet.service.adam.entity.AdamEnters
;
import
com.liquidnet.service.adam.entity.AdamRealName
;
import
com.liquidnet.service.adam.entity.AdamUserMember
;
import
com.liquidnet.service.adam.entity.AdamUserMember
;
import
com.liquidnet.service.kylin.constant.KylinRedisConst
;
import
com.liquidnet.service.kylin.constant.KylinRedisConst
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiBadgeMapper
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiPassportMapper
;
import
com.liquidnet.service.adam.mapper.AdamCaomeiPassportMapper
;
import
com.liquidnet.service.adam.mapper.AdamEntersMapper
;
import
com.liquidnet.service.adam.mapper.AdamEntersMapper
;
import
com.liquidnet.service.adam.mapper.AdamRealNameMapper
;
import
com.liquidnet.service.adam.mapper.AdamUserMapper
;
import
com.liquidnet.service.adam.mapper.AdamUserMapper
;
import
com.liquidnet.service.adam.mapper.AdamUserMemberMapper
;
import
com.liquidnet.service.adam.mapper.AdamUserMemberMapper
;
import
com.liquidnet.service.adam.util.ObjectUtil
;
import
com.liquidnet.service.adam.util.ObjectUtil
;
...
@@ -55,6 +58,8 @@ public class AdamRdmService {
...
@@ -55,6 +58,8 @@ public class AdamRdmService {
@Autowired
@Autowired
AdamUserMemberMapper
adamUserMemberMapper
;
AdamUserMemberMapper
adamUserMemberMapper
;
@Autowired
@Autowired
AdamRealNameMapper
adamRealNameMapper
;
@Autowired
AdamEntersMapper
adamEntersMapper
;
AdamEntersMapper
adamEntersMapper
;
@Autowired
@Autowired
AdamCaomeiBadgeMapper
adamCaomeiBadgeMapper
;
AdamCaomeiBadgeMapper
adamCaomeiBadgeMapper
;
...
@@ -271,6 +276,50 @@ public class AdamRdmService {
...
@@ -271,6 +276,50 @@ public class AdamRdmService {
redisUtil
.
del
(
AdamRedisConst
.
INFO_REAL_NAME
.
concat
(
uid
));
redisUtil
.
del
(
AdamRedisConst
.
INFO_REAL_NAME
.
concat
(
uid
));
}
}
/**
* 根据身份证号查询已实名绑定的 uid(优先 Redis,未命中回源 MySQL 并回写 Redis)
* 返回空表示未绑定或不可用。
*/
public
String
getRealNameBoundUidByIdCard
(
String
idCard
)
{
if
(
StringUtils
.
isEmpty
(
idCard
))
{
return
""
;
}
String
key
=
AdamRedisConst
.
INFO_REAL_NAME_UID_BY_IDCARD
.
concat
(
idCard
);
try
{
String
uid
=
(
String
)
redisUtil
.
get
(
key
);
if
(!
StringUtils
.
isEmpty
(
uid
))
{
return
uid
;
}
}
catch
(
Exception
e
)
{
log
.
warn
(
"[getRealNameBoundUidByIdCard] redis get failed, key: {}"
,
key
,
e
);
}
// 回源 MySQL:取任意一个 state=1 的 uid(同证件号按规则应唯一)
try
{
AdamRealName
r
=
adamRealNameMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
AdamRealName
.
class
)
.
eq
(
AdamRealName:
:
getState
,
1
)
.
eq
(
AdamRealName:
:
getType
,
1
)
.
eq
(
AdamRealName:
:
getIdCard
,
idCard
)
.
orderByDesc
(
AdamRealName:
:
getMid
)
.
last
(
"limit 1"
)
);
String
uid
=
r
!=
null
?
org
.
springframework
.
util
.
StringUtils
.
trimWhitespace
(
r
.
getUid
())
:
""
;
if
(!
StringUtils
.
isEmpty
(
uid
))
{
try
{
// 30天过期:防止长期脏数据无法自愈;真实解绑/注销可再补 delete
redisUtil
.
set
(
key
,
uid
,
60L
*
60
*
24
*
30
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"[getRealNameBoundUidByIdCard] redis set failed, key: {}"
,
key
,
e
);
}
}
return
uid
;
}
catch
(
Exception
e
)
{
log
.
error
(
"[getRealNameBoundUidByIdCard] mysql fallback failed, idCard: {}"
,
idCard
,
e
);
// 降级:查询失败直接放行(由上层决定是否继续阻断)
return
""
;
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
public
boolean
setCertificationJunk
(
int
idType
,
String
idNo
,
String
idName
)
{
public
boolean
setCertificationJunk
(
int
idType
,
String
idNo
,
String
idName
)
{
...
...
liquidnet-bus-service/liquidnet-service-adam/liquidnet-service-adam-impl/src/main/resources/errors.properties
View file @
e4a49505
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
10611
=
\u
60A8
\u6682\u
65E0
\u
8D2D
\u7968\u
8BB0
\u
5F55
\u
FF0C
\u
8BF7
\u
4E0A
\u
4F20
\u
8BA2
\u5355\u
622A
\u
56FE
10611
=
\u
60A8
\u6682\u
65E0
\u
8D2D
\u7968\u
8BB0
\u
5F55
\u
FF0C
\u
8BF7
\u
4E0A
\u
4F20
\u
8BA2
\u5355\u
622A
\u
56FE
10612
=
\u7279\u
6B8A
\u
5FBD
\u
7AE0
\u
4E0D
\u
53EF
\u
81EA
\u
52A9
\u9886\u
53D6
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
10613
=
\u
672A
\u
77E5
\u7684\u
5FBD
\u
7AE0
\u
7C7B
\u
578B
10614
=
\u
8BE5
\u
5B9E
\u
540D
\u
4FE1
\u
606F
\u
5DF2
\u
7ED1
\u
5B9A
\u5176\u
4ED6
\u
8D26
\u
53F7
...
...
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