Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-api
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
李伟
cust-api
Commits
7896e132
Commit
7896e132
authored
Apr 24, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了实名认证接口逻辑
parent
2eb2165c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
175 additions
and
295 deletions
+175
-295
FaceVerifyServiceImpl.java
...libaba/faceVerify/service/impl/FaceVerifyServiceImpl.java
+174
-218
AppOpmArticleController.java
...ft/app/appArticle/controller/AppOpmArticleController.java
+1
-1
AppMemInfoController.java
...isoft/app/appMemInfo/controller/AppMemInfoController.java
+0
-15
MemInfoService.java
.../org/rcisoft/business/memInfo/service/MemInfoService.java
+0
-2
MemInfoServiceImpl.java
...oft/business/memInfo/service/impl/MemInfoServiceImpl.java
+0
-59
No files found.
src/main/java/org/rcisoft/alibaba/faceVerify/service/impl/FaceVerifyServiceImpl.java
View file @
7896e132
...
@@ -18,9 +18,7 @@ import org.rcisoft.business.memGoldCoinFlow.dao.MemGoldCoinFlowRepository;
...
@@ -18,9 +18,7 @@ import org.rcisoft.business.memGoldCoinFlow.dao.MemGoldCoinFlowRepository;
import
org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow
;
import
org.rcisoft.business.memGoldCoinFlow.entity.MemGoldCoinFlow
;
import
org.rcisoft.business.memInfo.dao.MemInfoRepository
;
import
org.rcisoft.business.memInfo.dao.MemInfoRepository
;
import
org.rcisoft.business.memInfo.entity.MemInfo
;
import
org.rcisoft.business.memInfo.entity.MemInfo
;
import
org.rcisoft.business.memInfo.service.impl.MemInfoServiceImpl
;
import
org.rcisoft.core.exception.CyServiceException
;
import
org.rcisoft.core.exception.CyServiceException
;
import
org.rcisoft.core.jwt.util.CyJwtUtil
;
import
org.rcisoft.core.service.CyRedisService
;
import
org.rcisoft.core.service.CyRedisService
;
import
org.rcisoft.core.util.CyAESUtils
;
import
org.rcisoft.core.util.CyAESUtils
;
import
org.rcisoft.core.util.CyAddressUtils
;
import
org.rcisoft.core.util.CyAddressUtils
;
...
@@ -29,9 +27,12 @@ import org.rcisoft.core.util.TimeUtil;
...
@@ -29,9 +27,12 @@ import org.rcisoft.core.util.TimeUtil;
import
org.rcisoft.sys.dictionary.entity.DictData
;
import
org.rcisoft.sys.dictionary.entity.DictData
;
import
org.rcisoft.sys.dictionary.service.impl.DictionaryServiceImpl
;
import
org.rcisoft.sys.dictionary.service.impl.DictionaryServiceImpl
;
import
org.rcisoft.sys.rbac.user.dao.SysUserRbacRepository
;
import
org.rcisoft.sys.rbac.user.dao.SysUserRbacRepository
;
import
org.rcisoft.sys.rbac.user.dto.SysUserRbacDTO
;
import
org.rcisoft.sys.rbac.user.entity.SysUserRbac
;
import
org.rcisoft.sys.rbac.user.entity.SysUserRbac
;
import
org.rcisoft.sys.rbac.user.enums.UserInfoExceptionEnums
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Isolation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
...
@@ -52,8 +53,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -52,8 +53,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
@Autowired
@Autowired
private
MemInfoRepository
memInfoRepository
;
private
MemInfoRepository
memInfoRepository
;
@Autowired
@Autowired
private
CyJwtUtil
cyJwtUtil
;
@Autowired
private
CyRedisService
cyRedisServiceImpl
;
private
CyRedisService
cyRedisServiceImpl
;
@Autowired
@Autowired
private
SysUserRbacRepository
sysUserRbacRepository
;
private
SysUserRbacRepository
sysUserRbacRepository
;
...
@@ -61,8 +60,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -61,8 +60,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
private
DictionaryServiceImpl
dictionaryService
;
private
DictionaryServiceImpl
dictionaryService
;
@Autowired
@Autowired
private
MemGoldCoinFlowRepository
memGoldCoinFlowRepository
;
private
MemGoldCoinFlowRepository
memGoldCoinFlowRepository
;
@Autowired
private
MemInfoServiceImpl
memInfoServiceImpl
;
/**
/**
* 发起认证请求
* 发起认证请求
* @param memInfo
* @param memInfo
...
@@ -70,11 +67,7 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -70,11 +67,7 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
*/
*/
@Override
@Override
public
Map
<
String
,
String
>
initFaceVerify
(
HttpServletRequest
httpServletRequest
,
MemInfo
memInfo
)
{
public
Map
<
String
,
String
>
initFaceVerify
(
HttpServletRequest
httpServletRequest
,
MemInfo
memInfo
)
{
// MemInfo memInfo = memInfoRepository.getInfoByUserId(CyUserUtil.getAuthenBusinessId());
Object
detail
=
this
.
checkIdCard
(
memInfo
);
// String idCard = CyAESUtils.decrypt(memInfo.getMemIdcard());
// String name = CyAESUtils.decrypt(memInfo.getMemRealName());
memInfoServiceImpl
.
checkIdCard
(
memInfo
);
Object
detail
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
CyUserUtil
.
getAuthenBusinessId
());
if
(
detail
!=
null
)
{
if
(
detail
!=
null
)
{
MemInfo
info
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
detail
),
MemInfo
.
class
);
MemInfo
info
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
detail
),
MemInfo
.
class
);
String
idCard
=
info
.
getMemIdcard
();
String
idCard
=
info
.
getMemIdcard
();
...
@@ -105,50 +98,16 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -105,50 +98,16 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
request
.
setReturnUrl
(
faceVerifyAliComp
.
getReturnUrl
()+
"?userId="
+
CyUserUtil
.
getAuthenBusinessId
());
request
.
setReturnUrl
(
faceVerifyAliComp
.
getReturnUrl
()+
"?userId="
+
CyUserUtil
.
getAuthenBusinessId
());
request
.
setCallbackUrl
(
faceVerifyAliComp
.
getCallbackUrl
());
request
.
setCallbackUrl
(
faceVerifyAliComp
.
getCallbackUrl
());
request
.
setCallbackToken
(
CyAESUtils
.
encrypt
(
CyUserUtil
.
getAuthenBusinessId
()));
request
.
setCallbackToken
(
CyAESUtils
.
encrypt
(
CyUserUtil
.
getAuthenBusinessId
()));
// 原始长链
request
.
setCertifyUrlStyle
(
"L"
);
InitFaceVerifyResponse
response
=
initFaceVerifyAutoRoute
(
request
);
InitFaceVerifyResponse
response
=
initFaceVerifyAutoRoute
(
request
);
log
.
info
(
"code:"
+
response
.
getBody
().
getCode
());
log
.
info
(
"certifyId:"
+
response
.
getBody
().
getResultObject
().
getCertifyId
());
if
(
"200"
.
equals
(
response
.
getBody
().
getCode
()))
{
if
(
"200"
.
equals
(
response
.
getBody
().
getCode
()))
{
map
.
put
(
"requestId"
,
response
.
getBody
().
getRequestId
());
map
.
put
(
"requestId"
,
response
.
getBody
().
getRequestId
());
map
.
put
(
"certifyId"
,
response
.
getBody
().
getResultObject
().
getCertifyId
());
map
.
put
(
"certifyId"
,
response
.
getBody
().
getResultObject
().
getCertifyId
());
map
.
put
(
"certifyUrl"
,
response
.
getBody
().
getResultObject
().
getCertifyUrl
());
map
.
put
(
"certifyUrl"
,
response
.
getBody
().
getResultObject
().
getCertifyUrl
());
}
else
{
}
else
{
HttpServletRequest
request1
=
((
ServletRequestAttributes
)
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
// 人脸识别异常处理
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request1
);
this
.
faceVerifyFail
(
idCard
);
Object
ipMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
// 1 设置 ip 每分钟的失败次数
if
(
ipMin
!=
null
)
{
int
count
=
(
int
)
ipMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
count
+
1
,
0
);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
1
,
60L
);
Object
ipDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
// 1 设置 ip 每天的失败次数
if
(
ipDay
!=
null
)
{
int
count
=
(
int
)
ipDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
count
+
1
,
0
);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
1
,
time
);
}
Object
idCardMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
);
// 1 设置 ip 每分钟的失败次数
if
(
idCardMin
!=
null
)
{
int
count
=
(
int
)
idCardMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
count
+
1
,
0
);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
1
,
60L
);
Object
idCardDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
);
// 1 设置 ip 每天的失败次数
if
(
idCardDay
!=
null
)
{
int
count
=
(
int
)
idCardDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
count
+
1
,
0
);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
1
,
time
);
}
if
(
"401"
.
equals
(
response
.
getBody
().
getCode
()))
{
if
(
"401"
.
equals
(
response
.
getBody
().
getCode
()))
{
log
.
error
(
"发起认证请求失败:"
+
response
.
getBody
().
getMessage
());
log
.
error
(
"发起认证请求失败:"
+
response
.
getBody
().
getMessage
());
throw
new
CyServiceException
(
"输入的姓名或者身份证号码有误"
);
throw
new
CyServiceException
(
"输入的姓名或者身份证号码有误"
);
...
@@ -236,11 +195,23 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -236,11 +195,23 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
@Transactional
@Transactional
public
Map
<
String
,
String
>
describeFaceVerify
(
InitFaceVerifyRequest
dto
)
{
public
Map
<
String
,
String
>
describeFaceVerify
(
InitFaceVerifyRequest
dto
)
{
String
userId
=
dto
.
getUserId
();
String
userId
=
dto
.
getUserId
();
if
(
userId
==
null
)
if
(
userId
==
null
){
userId
=
CyUserUtil
.
getAuthenBusinessId
();
throw
new
CyServiceException
(
"系统异常,请稍后重试"
);
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Map
<
String
,
String
>
map
=
new
HashMap
<>();
Object
detail
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
userId
);
if
(
detail
==
null
){
throw
new
CyServiceException
(
"系统异常,请稍后重试"
);
}
MemInfo
info
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
detail
),
MemInfo
.
class
);
MemInfo
memInfo
=
memInfoRepository
.
getInfoByUserId
(
userId
);
MemInfo
memInfo
=
memInfoRepository
.
getInfoByUserId
(
userId
);
if
(
"0"
.
equals
(
memInfo
.
getMemRealAuthen
()))
{
String
idCard
=
info
.
getMemIdcard
();
String
realName
=
info
.
getMemRealName
();
if
(
"1"
.
equals
(
memInfo
.
getMemRealAuthen
())){
// 已经实名认证完了 加次数
this
.
faceVerifyFail
(
idCard
);
throw
new
CyServiceException
(
"用户已实名,无需再次实名认证"
);
}
// 创建API请求并设置参数。
// 创建API请求并设置参数。
DescribeFaceVerifyRequest
request
=
new
DescribeFaceVerifyRequest
();
DescribeFaceVerifyRequest
request
=
new
DescribeFaceVerifyRequest
();
// 场景ID+L。
// 场景ID+L。
...
@@ -248,16 +219,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -248,16 +219,6 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
// CertifyId在InitFaceVerify接口的返回值中。
// CertifyId在InitFaceVerify接口的返回值中。
request
.
setCertifyId
(
dto
.
getCertifyId
());
request
.
setCertifyId
(
dto
.
getCertifyId
());
DescribeFaceVerifyResponse
response
=
describeFaceVerifyAutoRoute
(
request
);
DescribeFaceVerifyResponse
response
=
describeFaceVerifyAutoRoute
(
request
);
Object
detail
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
userId
);
if
(
detail
!=
null
)
{
MemInfo
info
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
detail
),
MemInfo
.
class
);
String
idCard
=
info
.
getMemIdcard
();
String
realName
=
info
.
getMemRealName
();
log
.
info
(
response
.
getBody
().
getRequestId
());
log
.
info
(
response
.
getBody
().
getCode
());
log
.
info
(
response
.
getBody
().
getMessage
());
map
.
put
(
"requestId"
,
response
.
getBody
().
getRequestId
());
map
.
put
(
"requestId"
,
response
.
getBody
().
getRequestId
());
map
.
put
(
"message"
,
response
.
getBody
().
getMessage
());
map
.
put
(
"message"
,
response
.
getBody
().
getMessage
());
if
(
"200"
.
equals
(
response
.
getBody
().
getCode
()))
{
if
(
"200"
.
equals
(
response
.
getBody
().
getCode
()))
{
...
@@ -265,7 +226,18 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -265,7 +226,18 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
log
.
info
(
"subCode:"
+
response
.
getBody
().
getResultObject
().
getSubCode
());
log
.
info
(
"subCode:"
+
response
.
getBody
().
getResultObject
().
getSubCode
());
map
.
put
(
"passed"
,
response
.
getBody
().
getResultObject
().
getPassed
());
map
.
put
(
"passed"
,
response
.
getBody
().
getResultObject
().
getPassed
());
map
.
put
(
"subCode"
,
response
.
getBody
().
getResultObject
().
getSubCode
());
map
.
put
(
"subCode"
,
response
.
getBody
().
getResultObject
().
getSubCode
());
if
(
"T"
.
equals
(
response
.
getBody
().
getResultObject
().
getPassed
()))
{
if
(
"F"
.
equals
(
response
.
getBody
().
getResultObject
().
getPassed
())){
// 识别失败 异常处理
this
.
faceVerifyFail
(
idCard
);
throw
new
CyServiceException
(
"实名认证未通过,请重试"
);
}
//身份证验重
SysUserRbacDTO
sysUserRbacDTO
=
baseMapper
.
checkIdcardRepeat
(
info
.
getUserId
(),
CyAESUtils
.
encrypt
(
info
.
getMemIdcard
()));
if
(
sysUserRbacDTO
!=
null
)
{
// 加次数
this
.
faceVerifyFail
(
idCard
);
throw
new
CyServiceException
(
UserInfoExceptionEnums
.
ID_NUMBER_EXISTS
);
}
List
<
DictData
>
userConfig
=
dictionaryService
.
selectByTypes
(
"user_config"
);
List
<
DictData
>
userConfig
=
dictionaryService
.
selectByTypes
(
"user_config"
);
DictData
dictData
=
userConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"real_auth_coin_count"
)).
findFirst
().
orElse
(
null
);
DictData
dictData
=
userConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"real_auth_coin_count"
)).
findFirst
().
orElse
(
null
);
Integer
coinCount
=
Integer
.
valueOf
(
dictData
.
getDictValue
());
Integer
coinCount
=
Integer
.
valueOf
(
dictData
.
getDictValue
());
...
@@ -296,52 +268,10 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -296,52 +268,10 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
memGoldCoinFlow
.
setActionType
(
"12"
);
memGoldCoinFlow
.
setActionType
(
"12"
);
memGoldCoinFlow
.
setTargetId
(
BigInteger
.
valueOf
(
Integer
.
valueOf
(
userId
)));
memGoldCoinFlow
.
setTargetId
(
BigInteger
.
valueOf
(
Integer
.
valueOf
(
userId
)));
memGoldCoinFlowRepository
.
insert
(
memGoldCoinFlow
);
memGoldCoinFlowRepository
.
insert
(
memGoldCoinFlow
);
}
else
{
HttpServletRequest
request1
=
((
ServletRequestAttributes
)
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request1
);
Object
ipMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
// 1 设置 ip 每分钟的失败次数
if
(
ipMin
!=
null
)
{
int
count
=
(
int
)
ipMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IP_MINUTES + ip, 1l);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
1
,
60L
);
Object
ipDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
// 1 设置 ip 每天的失败次数
if
(
ipDay
!=
null
)
{
int
count
=
(
int
)
ipDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IP_DAY + ip, 1l);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
1
,
time
);
}
Object
idCardMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
);
// 1 设置 ip 每分钟的失败次数
if
(
idCardMin
!=
null
)
{
int
count
=
(
int
)
idCardMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IDCARD_MINUTES + idCard, 1l);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
1
,
60L
);
Object
idCardDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
);
// 1 设置 ip 每天的失败次数
if
(
idCardDay
!=
null
)
{
int
count
=
(
int
)
idCardDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IDCARD_DAY + idCard, 1l);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
1
,
time
);
}
}
}
else
{
}
else
{
log
.
error
(
"获取认证详细数据失败:"
+
response
.
getBody
().
getMessage
());
log
.
error
(
"获取认证详细数据失败:"
+
response
.
getBody
().
getMessage
());
throw
new
CyServiceException
(
response
.
getBody
().
getMessage
());
throw
new
CyServiceException
(
response
.
getBody
().
getMessage
());
}
}
}
}
map
.
put
(
"realAuthen"
,
memInfo
.
getMemRealAuthen
());
map
.
put
(
"realAuthen"
,
memInfo
.
getMemRealAuthen
());
return
map
;
return
map
;
}
}
...
@@ -401,74 +331,10 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -401,74 +331,10 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
@Override
@Override
@Transactional
public
void
callbackFaceVerify
(
String
callbackToken
,
String
certifyId
,
String
passed
)
{
public
void
callbackFaceVerify
(
String
callbackToken
,
String
certifyId
,
String
passed
)
{
// String userId = CyUserUtil.getUserInfoStrProp(callbackToken,CyUserUtil.USER_ID);
log
.
info
(
"回调callbackToken:"
+
callbackToken
);
String
userId
=
CyAESUtils
.
decrypt
(
callbackToken
);
if
(
userId
!=
null
){
log
.
info
(
"回调certifyId:"
+
certifyId
);
log
.
info
(
"回调certifyId:"
+
certifyId
);
log
.
info
(
"回调passed:"
+
passed
);
log
.
info
(
"回调passed:"
+
passed
);
MemInfo
memInfo
=
memInfoRepository
.
getInfoByUserId
(
userId
);
//认证成功
if
(
"0"
.
equals
(
memInfo
.
getMemRealAuthen
()))
{
Object
detail
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
userId
);
if
(
detail
!=
null
)
{
MemInfo
info
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
detail
),
MemInfo
.
class
);
String
idCard
=
info
.
getMemIdcard
();
String
realName
=
info
.
getMemRealName
();
if
(
"200"
.
equals
(
passed
))
{
memInfo
.
setMemRealAuthen
(
"1"
);
memInfo
.
setMemRealAuthenDate
(
new
Date
());
memInfo
.
setMemIdcard
(
CyAESUtils
.
encrypt
(
idCard
));
memInfo
.
setMemRealName
(
CyAESUtils
.
encrypt
(
realName
));
memInfoRepository
.
updateById
(
memInfo
);
//修改sys_user
SysUserRbac
userRbac
=
new
SysUserRbac
(
memInfo
.
getUserId
());
userRbac
.
setIdNumber
(
memInfo
.
getMemIdcard
());
sysUserRbacRepository
.
updateById
(
userRbac
);
}
else
{
HttpServletRequest
request1
=
((
ServletRequestAttributes
)
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request1
);
Object
ipMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
// 1 设置 ip 每分钟的失败次数
if
(
ipMin
!=
null
)
{
int
count
=
(
int
)
ipMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IP_MINUTES + ip, 1l);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
1
,
60L
);
Object
ipDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
// 1 设置 ip 每天的失败次数
if
(
ipDay
!=
null
)
{
int
count
=
(
int
)
ipDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IP_DAY + ip, 1l);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
1
,
time
);
}
Object
idCardMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
);
// 1 设置 ip 每分钟的失败次数
if
(
idCardMin
!=
null
)
{
int
count
=
(
int
)
idCardMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IDCARD_MINUTES + idCard, 1l);
}
else
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
1
,
60L
);
Object
idCardDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
);
// 1 设置 ip 每天的失败次数
if
(
idCardDay
!=
null
)
{
int
count
=
(
int
)
idCardDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
count
+
1
,
0
);
// cyRedisServiceImpl.incr(FaceVerifyRedisBean.FACEVERIFY_IDCARD_DAY + idCard, 1l);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
1
,
time
);
}
}
}
}
}
}
}
public
static
String
getConstellation
(
String
birth
)
{
public
static
String
getConstellation
(
String
birth
)
{
...
@@ -502,4 +368,94 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
...
@@ -502,4 +368,94 @@ public class FaceVerifyServiceImpl extends ServiceImpl<MemInfoRepository, MemInf
return
"2"
;
//双鱼座
return
"2"
;
//双鱼座
}
}
}
}
// 人脸识别异常处理 加次数
public
void
faceVerifyFail
(
String
idCard
){
HttpServletRequest
request1
=
((
ServletRequestAttributes
)
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request1
);
Object
ipMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
// 1 设置 ip 每分钟的失败次数
if
(
ipMin
!=
null
)
{
int
count
=
(
int
)
ipMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
count
+
1
,
0
);
}
else
{
boolean
set
=
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
,
1
,
60L
);
log
.
info
(
"设置:"
+
set
);
}
Object
ipDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
// 1 设置 ip 每天的失败次数
if
(
ipDay
!=
null
)
{
int
count
=
(
int
)
ipDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
count
+
1
,
0
);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
,
1
,
time
);
}
Object
idCardMin
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
);
// 1 设置 身份证号 每分钟的失败次数
if
(
idCardMin
!=
null
)
{
int
count
=
(
int
)
idCardMin
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
count
+
1
,
0
);
}
else
{
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
idCard
,
1
,
60L
);
}
Object
idCardDay
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
);
// 1 设置 身份证号 每天的失败次数
if
(
idCardDay
!=
null
)
{
int
count
=
(
int
)
idCardDay
;
cyRedisServiceImpl
.
setValueNotTime
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
count
+
1
,
0
);
}
else
{
long
time
=
TimeUtil
.
getTimeSecond
(
new
Date
(),
TimeUtil
.
getTodayEndTime
());
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
idCard
,
1
,
time
);
}
}
/**
* 校验身份证号次数
* @param memInfo
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
public
Object
checkIdCard
(
MemInfo
memInfo
){
MemInfo
info
=
baseMapper
.
getInfoByUserId
(
String
.
valueOf
(
memInfo
.
getUserId
()));
//验证失败次数
//获取ip
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request
);
//1. 同一IP,每分钟失败次数
Object
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIpMinCount
())
throw
new
CyServiceException
(
"当前IP实名认证发起频繁,请稍后重试"
);
}
//2. 同一IP,每天失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIpDayCount
())
throw
new
CyServiceException
(
"当前IP实名认证次数已达上限,请明日再试!"
);
}
//3. 同一身份证,每分钟失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
memInfo
.
getMemIdcard
());
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIdCardMinCount
())
throw
new
CyServiceException
(
"实名认证发起频繁,请稍后重试"
);
}
//4. 同一身份证,每天失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
memInfo
.
getMemIdcard
());
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIdCardDayCount
())
throw
new
CyServiceException
(
"实名认证次数已达上限,请明日再试!"
);
}
if
(
"1"
.
equals
(
info
.
getMemRealAuthen
())){
// 加次数
this
.
faceVerifyFail
(
memInfo
.
getMemIdcard
());
throw
new
CyServiceException
(
"用户已实名,无需再次实名认证"
);
}
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
memInfo
.
getUserId
(),
memInfo
,
3600L
);
return
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
memInfo
.
getUserId
());
}
}
}
src/main/java/org/rcisoft/app/appArticle/controller/AppOpmArticleController.java
View file @
7896e132
...
@@ -149,7 +149,7 @@ public class AppOpmArticleController extends CyPaginationController<OpmArticle>
...
@@ -149,7 +149,7 @@ public class AppOpmArticleController extends CyPaginationController<OpmArticle>
* 逻辑删除评论
* 逻辑删除评论
*/
*/
@PreAuthorize
(
"@cyPerm.hasPerm('app:opmArticle:delete')"
)
@PreAuthorize
(
"@cyPerm.hasPerm('app:opmArticle:delete')"
)
@DeleteMapping
(
"/deleteComment/{businessId:\\w+}"
)
@DeleteMapping
(
"/
opmArticle/
deleteComment/{businessId:\\w+}"
)
public
CyResult
deleteComment
(
@PathVariable
String
businessId
,
@RequestBody
ArticleCommentDTO
dto
)
{
public
CyResult
deleteComment
(
@PathVariable
String
businessId
,
@RequestBody
ArticleCommentDTO
dto
)
{
dto
.
setBusinessId
(
Integer
.
valueOf
(
businessId
));
dto
.
setBusinessId
(
Integer
.
valueOf
(
businessId
));
CyPersistModel
data
=
opmArticleServiceImpl
.
removeComment
(
dto
,
"app"
);
CyPersistModel
data
=
opmArticleServiceImpl
.
removeComment
(
dto
,
"app"
);
...
...
src/main/java/org/rcisoft/app/appMemInfo/controller/AppMemInfoController.java
View file @
7896e132
...
@@ -248,21 +248,6 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
...
@@ -248,21 +248,6 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
}
}
}
}
@PreAuthorize
(
"@cyPerm.hasPerm('app:mem:query')"
)
@CyOpeLogAnno
(
title
=
"system-会员表管理-校验实名认证信息"
,
businessType
=
CyLogTypeEnum
.
UPDATE
)
@Operation
(
summary
=
"校验实名认证信息"
,
description
=
"校验实名认证信息"
)
@Parameters
({
@Parameter
(
name
=
"businessId"
,
description
=
"businessId"
,
required
=
false
,
schema
=
@Schema
(
type
=
"string"
))})
@PutMapping
(
"/memInfo/checkIdCard/{userId:\\w+}"
)
@CyEncryptSm4Anno
public
CyResult
checkIdCard
(
@PathVariable
int
userId
,
@RequestBody
MemInfo
memInfo
,
BindingResult
bindingResult
)
{
memInfo
.
setUserId
(
userId
);
CyPersistModel
data
=
memInfoServiceImpl
.
checkIdCard
(
memInfo
);
return
CyResultGenUtil
.
builder
(
data
,
CyMessCons
.
MESSAGE_ALERT_SUCCESS
,
CyMessCons
.
MESSAGE_ALERT_ERROR
,
memInfo
);
}
/**
/**
* 会员基础信息页面-修改个人资料
* 会员基础信息页面-修改个人资料
*/
*/
...
...
src/main/java/org/rcisoft/business/memInfo/service/MemInfoService.java
View file @
7896e132
...
@@ -95,8 +95,6 @@ public interface MemInfoService {
...
@@ -95,8 +95,6 @@ public interface MemInfoService {
ArticleExamStatus
getArticle
(
ArticleExamStatus
articleExamStatus
);
ArticleExamStatus
getArticle
(
ArticleExamStatus
articleExamStatus
);
CyPersistModel
checkIdCard
(
MemInfo
memInfo
);
CyPersistModel
update
(
MemInfo
memInfo
);
CyPersistModel
update
(
MemInfo
memInfo
);
CyPersistModel
addFollow
(
MemFollowDTO
followDTO
);
CyPersistModel
addFollow
(
MemFollowDTO
followDTO
);
...
...
src/main/java/org/rcisoft/business/memInfo/service/impl/MemInfoServiceImpl.java
View file @
7896e132
...
@@ -88,8 +88,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -88,8 +88,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
@Autowired
@Autowired
private
DictionaryService
dictionaryService
;
private
DictionaryService
dictionaryService
;
@Autowired
@Autowired
private
CyRedisService
cyRedisService
;
@Autowired
private
StringRedisTemplate
redisTemplate
;
private
StringRedisTemplate
redisTemplate
;
@Autowired
@Autowired
private
MemInfoRepository
memInfoRepository
;
private
MemInfoRepository
memInfoRepository
;
...
@@ -536,63 +534,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -536,63 +534,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
}
}
/**
* 修改 会员表
* @param memInfo
* @return
*/
@Transactional
(
propagation
=
Propagation
.
REQUIRED
,
isolation
=
Isolation
.
DEFAULT
)
@Override
public
CyPersistModel
checkIdCard
(
MemInfo
memInfo
){
MemInfo
info
=
baseMapper
.
getInfoByUserId
(
String
.
valueOf
(
memInfo
.
getUserId
()));
if
(
"1"
.
equals
(
info
.
getMemRealAuthen
()))
throw
new
CyServiceException
(
"用户已实名,无需再次实名认证"
);
//手机号、身份证存储加密
// if (StringUtils.isNotBlank(memInfo.getMemIdcard()))
// info.setMemIdcard(CyAESUtils.encrypt(memInfo.getMemIdcard()));
// if (StringUtils.isNotBlank(memInfo.getMemRealName()))
// info.setMemRealName(CyAESUtils.encrypt(memInfo.getMemRealName()));
//身份证验重
SysUserRbacDTO
sysUserRbacDTO
=
baseMapper
.
checkIdcardRepeat
(
memInfo
.
getUserId
(),
CyAESUtils
.
encrypt
(
memInfo
.
getMemIdcard
()));
if
(
sysUserRbacDTO
!=
null
)
{
throw
new
CyServiceException
(
UserInfoExceptionEnums
.
ID_NUMBER_EXISTS
);
}
//验证失败次数
//获取ip
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
ip
=
CyAddressUtils
.
IpUtils
.
getIpAddr
(
request
);
//1. 同一IP,每分钟失败次数
Object
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_MINUTES
+
ip
);
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIpMinCount
())
throw
new
CyServiceException
(
"当前IP实名认证发起频繁,请稍后重试"
);
}
//2. 同一IP,每天失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IP_DAY
+
ip
);
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIpDayCount
())
throw
new
CyServiceException
(
"当前IP实名认证次数已达上限,请明日再试!"
);
}
//3. 同一身份证,每分钟失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_MINUTES
+
memInfo
.
getMemIdcard
());
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIdCardMinCount
())
throw
new
CyServiceException
(
"实名认证发起频繁,请稍后重试"
);
}
//4. 同一身份证,每天失败次数
captcha
=
cyRedisServiceImpl
.
get
(
FaceVerifyRedisBean
.
FACEVERIFY_IDCARD_DAY
+
memInfo
.
getMemIdcard
());
if
(
captcha
!=
null
)
{
int
count
=
(
int
)
captcha
;
if
(
count
>=
faceVerifyAliComp
.
getIdCardDayCount
())
throw
new
CyServiceException
(
"实名认证次数已达上限,请明日再试!"
);
}
cyRedisServiceImpl
.
set
(
FaceVerifyRedisBean
.
FACEVERIFY_USER
+
memInfo
.
getUserId
(),
memInfo
,
3600L
);
return
new
CyPersistModel
(
1
);
}
/**
/**
* 修改 会员表
* 修改 会员表
* @param memInfo
* @param memInfo
...
...
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