Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
602b0cd5
Commit
602b0cd5
authored
Nov 15, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
4e3b4cfa
dfca75c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
16 deletions
+43
-16
CertificationService.java
...xxfc/platform/universal/service/CertificationService.java
+43
-16
No files found.
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/CertificationService.java
View file @
602b0cd5
package
com
.
xxfc
.
platform
.
universal
.
service
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.map.MapUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
...
...
@@ -31,6 +32,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
...
...
@@ -62,7 +64,8 @@ public class CertificationService {
private
UserPictureParsing
userPictureParsing
;
/**
* 一、身份证图片进行实名认证
* 一、身份证图片进行实名认证
*
* @param idInformation
* @return
*/
...
...
@@ -103,6 +106,15 @@ public class CertificationService {
if
(
idInformation
.
getIdNumber
().
equals
(
number
))
{
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"证件号不一致"
);
}
Example
exa
=
new
Example
(
IdInformation
.
class
);
Example
.
Criteria
criteria
=
exa
.
createCriteria
();
criteria
.
andEqualTo
(
"idNumber"
,
idInformation
.
getIdNumber
());
List
<
IdInformation
>
idInformatics
=
idInformationMapper
.
selectByExample
(
exa
);
if
(
CollectionUtil
.
isNotEmpty
(
idInformatics
))
{
log
.
error
(
"该身份证已存在,不要重复认证"
);
log
.
info
(
"图片已解析,未认证"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"该身份证已存在,不要重复认证"
);
}
//3.验证
boolean
result
=
authentication
.
certificate
(
new
UserMessage
()
{{
setIdNumber
(
number
);
...
...
@@ -159,28 +171,18 @@ public class CertificationService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ObjectRestResponse
<
Integer
>
addIdInformation
(
IdInformation
idInformation
)
{
log
.
info
(
"----idInformation========="
+
idInformation
);
//保存认证信息
try
{
Example
exa
=
new
Example
(
IdInformation
.
class
);
Example
.
Criteria
criteria
=
exa
.
createCriteria
();
criteria
.
andEqualTo
(
"idNumber"
,
idInformation
.
getIdNumber
());
List
<
IdInformation
>
idInformatics
=
idInformationMapper
.
selectByExample
(
exa
);
if
(
CollectionUtils
.
isEmpty
(
idInformatics
))
{
idInformation
.
setCrtTime
(
new
Date
());
idInformationMapper
.
insertSelective
(
idInformation
);
}
else
{
log
.
error
(
"该身份证已存在,不要重复认证"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"该身份证已存在,不要重复认证"
);
}
idInformation
.
setCrtTime
(
new
Date
());
idInformationMapper
.
insertSelective
(
idInformation
);
log
.
info
(
"----addIdInformation---userid==="
+
idInformation
.
getUserLoginId
()
+
"----name===="
+
idInformation
.
getName
()
+
"---IdNumber==="
+
idInformation
.
getIdNumber
());
//认证成功后修改用户,用户认证状态
ObjectRestResponse
authentication
=
userFeign
.
authentication
(
idInformation
.
getUserLoginId
(),
idInformation
.
getName
(),
idInformation
.
getIdNumber
(),
1
);
userFeign
.
authentication
(
idInformation
.
getUserLoginId
(),
idInformation
.
getName
(),
idInformation
.
getIdNumber
(),
1
);
return
ObjectRestResponse
.
succ
(
idInformation
.
getId
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
TransactionAspectSupport
.
currentTransactionStatus
();
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
INCOMPLETE_DATA
,
"
无法识别,请重新上传
"
);
TransactionAspectSupport
.
currentTransactionStatus
()
.
setRollbackOnly
()
;
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
INCOMPLETE_DATA
,
"
认证失败,请重新认证
"
);
}
}
...
...
@@ -188,6 +190,31 @@ public class CertificationService {
return
idInformationMapper
.
selectByUserId
(
userId
);
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
delete
(
Integer
userId
)
{
try
{
int
i
=
idInformationMapper
.
deleteByExample
(
Example
.
builder
(
IdInformation
.
class
)
.
where
(
WeekendSqls
.<
IdInformation
>
custom
()
.
andEqualTo
(
IdInformation:
:
getUserLoginId
,
userId
)).
build
());
if
(
i
==
1
){
return
true
;
}
else
{
log
.
info
(
"删除行数= {}"
,
i
);
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
return
false
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
log
.
info
(
"删除报错"
);
return
false
;
}
}
}
...
...
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