记得上下班打卡 | 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
d6f5088b
Commit
d6f5088b
authored
Jan 28, 2024
by
zhangguobing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
~api:券商品业务-下单+身份证关联人二要素验证;
parent
a3b9debf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
0 deletions
+90
-0
GoblinOrderServiceImpl.java
...et/service/order/service/impl/GoblinOrderServiceImpl.java
+1
-0
AdamRedisUtils.java
...ava/com/liquidnet/service/order/utils/AdamRedisUtils.java
+89
-0
No files found.
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/service/impl/GoblinOrderServiceImpl.java
View file @
d6f5088b
...
...
@@ -271,6 +271,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_REF
,
skuParam
.
getIdNo
()))
{
throw
new
LiquidnetServiceException
(
"-1"
,
"身份证号码不合规"
);
}
adamRedisUtils
.
identityHandler1
(
uid
,
skuParam
.
getIdName
(),
skuParam
.
getIdNo
());
break
;
case
2
:
if
(!
Pattern
.
matches
(
LnsRegex
.
Valid
.
CN_ID_CARD_HM
,
skuParam
.
getIdNo
()))
{
...
...
liquidnet-bus-service/liquidnet-service-order/liquidnet-service-order-impl/src/main/java/com/liquidnet/service/order/utils/AdamRedisUtils.java
View file @
d6f5088b
package
com
.
liquidnet
.
service
.
order
.
utils
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.liquidnet.common.cache.redis.util.RedisUtil
;
import
com.liquidnet.common.exception.LiquidnetServiceException
;
import
com.liquidnet.commons.lang.util.IdentityUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.adam.constant.AdamRedisConst
;
import
com.liquidnet.service.adam.dto.vo.AdamUserInfoVo
;
import
com.liquidnet.service.adam.dto.vo.AdamUserMemberVo
;
import
com.liquidnet.service.base.ErrorMapping
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.time.LocalDateTime
;
...
...
@@ -34,4 +40,87 @@ public class AdamRedisUtils {
log
.
debug
(
"#RDM耗时:{}ms"
,
System
.
currentTimeMillis
()
-
s
);
return
vo
;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
private
boolean
setCertificationJunk
(
int
idType
,
String
idNo
,
String
idName
)
{
return
redisUtil
.
set
(
AdamRedisConst
.
INFO_CERTIFICATION_JUNK
+
idType
+
idNo
,
idName
,
604800
);
}
private
boolean
isCertificationJunk
(
int
idType
,
String
idNo
,
String
idName
)
{
String
o
=
(
String
)
redisUtil
.
get
(
AdamRedisConst
.
INFO_CERTIFICATION_JUNK
+
idType
+
idNo
);
return
!
StringUtils
.
isEmpty
(
o
)
&&
o
.
equals
(
idName
);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证成功的<ID_TYPE+ID_NO, ID_NAME> */
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
private
boolean
setCertification
(
int
idType
,
String
idNo
,
String
idName
)
{
return
redisUtil
.
set
(
AdamRedisConst
.
INFO_CERTIFICATION
+
idType
+
idNo
,
idName
);
}
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
private
int
isCertification
(
int
idType
,
String
idNo
,
String
idName
)
{
String
o
=
(
String
)
redisUtil
.
get
(
AdamRedisConst
.
INFO_CERTIFICATION
+
idType
+
idNo
);
if
(
StringUtils
.
isEmpty
(
o
))
{
return
-
1
;
}
return
o
.
equals
(
idName
)
?
1
:
0
;
// return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证处理 */
/**
* 身份证实名处理
*
* @param uid
* @param name
* @param idCard
*/
public
void
identityHandler1
(
String
uid
,
String
name
,
String
idCard
)
{
int
rst
=
this
.
isCertification
(
1
,
idCard
,
name
);
switch
(
rst
)
{
case
-
1
:
// 本地不存在
if
(
this
.
isCertificationJunk
(
1
,
idCard
,
name
))
{
throw
new
LiquidnetServiceException
(
"-1"
,
"身份证号与姓名不符"
);
}
String
respStr
=
IdentityUtils
.
aliThird
(
name
,
idCard
),
respErrorCode
=
null
;
JsonNode
respJNode
=
JsonUtils
.
fromJson
(
respStr
,
JsonNode
.
class
);
if
(
null
==
respJNode
||
!
"0"
.
equals
(
respErrorCode
=
String
.
valueOf
(
respJNode
.
get
(
"error_code"
))))
{
log
.
info
(
"###实名认证失败[{}]"
,
respStr
);
// this.setCertificationJunk(1, idCard, name);
if
(!
StringUtils
.
isEmpty
(
respErrorCode
)
&&
org
.
apache
.
commons
.
lang3
.
StringUtils
.
indexOf
(
"3000290033"
,
respErrorCode
)
<
0
)
{
// 认证服务商'30002'、'90033'为运营商导致的失败,这里不做缓存标记
this
.
setCertificationJunk
(
1
,
idCard
,
name
);
}
throw
new
LiquidnetServiceException
(
"-1"
,
"身份证号与姓名不符"
);
}
this
.
setCertification
(
1
,
idCard
,
name
);
break
;
case
0
:
// 本地存在,验证不通过
throw
new
LiquidnetServiceException
(
"-1"
,
"身份证号与姓名不符"
);
case
1
:
// 本地存在,验证通过
break
;
}
}
}
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