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
e0c44221
Commit
e0c44221
authored
Jun 11, 2019
by
youjj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实名认证
parent
d381be58
Changes
15
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1503 additions
and
2 deletions
+1503
-2
ObjectRestResponse.java
...ithub/wxiaoqi/security/common/msg/ObjectRestResponse.java
+3
-0
ResultCode.java
...thub/wxiaoqi/security/common/util/process/ResultCode.java
+4
-0
resultcod.properties
...common/src/main/resources/properties/resultcod.properties
+10
-1
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+7
-0
IdInformation.java
...ava/com/xxfc/platform/universal/entity/IdInformation.java
+70
-0
CertifHttpUtils.java
...va/com/xxfc/platform/universal/utils/CertifHttpUtils.java
+311
-0
Validation.java
...in/java/com/xxfc/platform/universal/utils/Validation.java
+370
-0
pom.xml
xx-universal/xx-universal-server/pom.xml
+38
-0
UniversalApplication.java
...ava/com/xxfc/platform/universal/UniversalApplication.java
+1
-1
IdInformationBiz.java
...ava/com/xxfc/platform/universal/biz/IdInformationBiz.java
+20
-0
CertificationController.java
...latform/universal/controller/CertificationController.java
+127
-0
IdInformationMapper.java
...m/xxfc/platform/universal/mapper/IdInformationMapper.java
+16
-0
CertificationService.java
...xxfc/platform/universal/service/CertificationService.java
+457
-0
application.properties
...niversal-server/src/main/resources/application.properties
+50
-0
IdInformationMapper.xml
...-server/src/main/resources/mapper/IdInformationMapper.xml
+19
-0
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/msg/ObjectRestResponse.java
View file @
e0c44221
...
@@ -24,6 +24,9 @@ public class ObjectRestResponse<T> extends BaseResponse {
...
@@ -24,6 +24,9 @@ public class ObjectRestResponse<T> extends BaseResponse {
this
.
rel
=
rel
;
this
.
rel
=
rel
;
}
}
public
boolean
getRel
()
{
return
this
.
rel
;
}
public
ObjectRestResponse
rel
(
boolean
rel
)
{
public
ObjectRestResponse
rel
(
boolean
rel
)
{
this
.
setRel
(
rel
);
this
.
setRel
(
rel
);
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/ResultCode.java
View file @
e0c44221
...
@@ -175,7 +175,11 @@ public class ResultCode {
...
@@ -175,7 +175,11 @@ public class ResultCode {
// 操作失败
// 操作失败
public
static
int
STOCK_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"STOCK_CODE"
));
public
static
int
STOCK_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"STOCK_CODE"
));
public
static
int
GET_AUTH_INFO_FAILED_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"GET_AUTH_INFO_FAILED_CODE"
));
public
static
int
WRONG_FORMAT_OF_ID_CARD
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"WRONG_FORMAT_OF_ID_CARD"
));
public
static
int
INCOMPLETE_DATA
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"INCOMPLETE_DATA"
));
public
static
String
getMsg
(
int
code
)
{
public
static
String
getMsg
(
int
code
)
{
return
SystemProperty
.
getResultConfig
(
String
.
valueOf
(
code
));
return
SystemProperty
.
getResultConfig
(
String
.
valueOf
(
code
));
}
}
...
...
ace-common/src/main/resources/properties/resultcod.properties
View file @
e0c44221
...
@@ -181,3 +181,12 @@ NO_SELECT_BY_RS=1010
...
@@ -181,3 +181,12 @@ NO_SELECT_BY_RS=1010
NOT_BIND_SOCIAL_CARD
=
3010
NOT_BIND_SOCIAL_CARD
=
3010
#库存不足
#库存不足
STOCK_CODE
=
201
STOCK_CODE
=
201
#获取用户认证信息失败
GET_AUTH_INFO_FAILED_CODE
=
4004
4004
=
获取用户认证信息失败!
#证件件格式
WRONG_FORMAT_OF_ID_CARD
=
4005
4005
=
证件格式错误!
#资料不全
INCOMPLETE_DATA
=
4006
4006
=
资料不齐全!
\ No newline at end of file
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
e0c44221
...
@@ -21,6 +21,13 @@ public interface UserFeign {
...
@@ -21,6 +21,13 @@ public interface UserFeign {
public
ObjectRestResponse
<
UserDTO
>
userinfoByToken
(
@RequestParam
(
"token"
)
String
token
);
public
ObjectRestResponse
<
UserDTO
>
userinfoByToken
(
@RequestParam
(
"token"
)
String
token
);
@RequestMapping
(
value
=
"/public/app/userinfo-by-token"
)
@RequestMapping
(
value
=
"/public/app/userinfo-by-token"
)
public
ObjectRestResponse
<
AppUserDTO
>
userDetailByToken
(
@RequestParam
(
"token"
)
String
token
);
public
ObjectRestResponse
<
AppUserDTO
>
userDetailByToken
(
@RequestParam
(
"token"
)
String
token
);
/**
*status:0-判断是否认证过,1-认证成功后修改用户认证状态
*userId:用户登录时的id,必须
*idNumber:证件号,修改认证状态是必须有
*/
@RequestMapping
(
value
=
"/api/app/user/authentication"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/api/app/user/authentication"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
authentication
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
public
ObjectRestResponse
authentication
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"idNumber"
)
String
idNumber
,
@RequestParam
(
value
=
"idNumber"
)
String
idNumber
,
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/entity/IdInformation.java
0 → 100644
View file @
e0c44221
package
com
.
xxfc
.
platform
.
universal
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 证件信息表
*/
@Table
(
name
=
"app_user_login"
)
@Data
public
class
IdInformation
implements
Serializable
{
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
private
Integer
id
;
//证件号
@Column
(
name
=
"id_number"
)
private
String
idNumber
;
//用户真实姓名
private
String
name
;
//用户id
@Column
(
name
=
"user_login_id"
)
private
Integer
userLonginId
;
//证件类型
@Column
(
name
=
"certificate_type"
)
private
Integer
certificateType
;
//正面url
@Column
(
name
=
"front_url"
)
private
String
frontUrl
;
//背面url
@Column
(
name
=
"back_url"
)
private
String
backUrl
;
//到期时间
@Column
(
name
=
"expiration_date"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyyMMdd"
,
timezone
=
"GMT+8"
)
private
Date
expirationDate
;
//认证方式
@Column
(
name
=
"authentication_methods"
)
private
Integer
authenticationMethods
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CertifHttpUtils.java
0 → 100644
View file @
e0c44221
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.HttpDelete
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.client.methods.HttpPut
;
import
org.apache.http.conn.ClientConnectionManager
;
import
org.apache.http.conn.scheme.Scheme
;
import
org.apache.http.conn.scheme.SchemeRegistry
;
import
org.apache.http.conn.ssl.SSLSocketFactory
;
import
org.apache.http.entity.ByteArrayEntity
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.DefaultHttpClient
;
import
org.apache.http.message.BasicNameValuePair
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.security.KeyManagementException
;
import
java.security.NoSuchAlgorithmException
;
import
java.security.cert.X509Certificate
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
public
class
CertifHttpUtils
{
/**
* get
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public
static
HttpResponse
doGet
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpGet
request
=
new
HttpGet
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
return
httpClient
.
execute
(
request
);
}
/**
* post form
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param bodys
* @return
* @throws Exception
*/
public
static
HttpResponse
doPost
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
Map
<
String
,
String
>
bodys
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpPost
request
=
new
HttpPost
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
if
(
bodys
!=
null
)
{
List
<
NameValuePair
>
nameValuePairList
=
new
ArrayList
<
NameValuePair
>();
for
(
String
key
:
bodys
.
keySet
())
{
nameValuePairList
.
add
(
new
BasicNameValuePair
(
key
,
bodys
.
get
(
key
)));
}
UrlEncodedFormEntity
formEntity
=
new
UrlEncodedFormEntity
(
nameValuePairList
,
"utf-8"
);
formEntity
.
setContentType
(
"application/x-www-form-urlencoded; charset=UTF-8"
);
request
.
setEntity
(
formEntity
);
}
return
httpClient
.
execute
(
request
);
}
/**
* Post String
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public
static
HttpResponse
doPost
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
String
body
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpPost
request
=
new
HttpPost
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
if
(
StringUtils
.
isNotBlank
(
body
))
{
request
.
setEntity
(
new
StringEntity
(
body
,
"utf-8"
));
}
return
httpClient
.
execute
(
request
);
}
/**
* Post stream
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public
static
HttpResponse
doPost
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
byte
[]
body
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpPost
request
=
new
HttpPost
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
if
(
body
!=
null
)
{
request
.
setEntity
(
new
ByteArrayEntity
(
body
));
}
return
httpClient
.
execute
(
request
);
}
/**
* Put String
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public
static
HttpResponse
doPut
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
String
body
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpPut
request
=
new
HttpPut
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
if
(
StringUtils
.
isNotBlank
(
body
))
{
request
.
setEntity
(
new
StringEntity
(
body
,
"utf-8"
));
}
return
httpClient
.
execute
(
request
);
}
/**
* Put stream
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @param body
* @return
* @throws Exception
*/
public
static
HttpResponse
doPut
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
byte
[]
body
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpPut
request
=
new
HttpPut
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
if
(
body
!=
null
)
{
request
.
setEntity
(
new
ByteArrayEntity
(
body
));
}
return
httpClient
.
execute
(
request
);
}
/**
* Delete
*
* @param host
* @param path
* @param method
* @param headers
* @param querys
* @return
* @throws Exception
*/
public
static
HttpResponse
doDelete
(
String
host
,
String
path
,
String
method
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
)
throws
Exception
{
HttpClient
httpClient
=
wrapClient
(
host
);
HttpDelete
request
=
new
HttpDelete
(
buildUrl
(
host
,
path
,
querys
));
for
(
Map
.
Entry
<
String
,
String
>
e
:
headers
.
entrySet
())
{
request
.
addHeader
(
e
.
getKey
(),
e
.
getValue
());
}
return
httpClient
.
execute
(
request
);
}
private
static
String
buildUrl
(
String
host
,
String
path
,
Map
<
String
,
String
>
querys
)
throws
UnsupportedEncodingException
{
StringBuilder
sbUrl
=
new
StringBuilder
();
sbUrl
.
append
(
host
);
if
(!
StringUtils
.
isBlank
(
path
))
{
sbUrl
.
append
(
path
);
}
if
(
null
!=
querys
)
{
StringBuilder
sbQuery
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
>
query
:
querys
.
entrySet
())
{
if
(
0
<
sbQuery
.
length
())
{
sbQuery
.
append
(
"&"
);
}
if
(
StringUtils
.
isBlank
(
query
.
getKey
())
&&
!
StringUtils
.
isBlank
(
query
.
getValue
()))
{
sbQuery
.
append
(
query
.
getValue
());
}
if
(!
StringUtils
.
isBlank
(
query
.
getKey
()))
{
sbQuery
.
append
(
query
.
getKey
());
if
(!
StringUtils
.
isBlank
(
query
.
getValue
()))
{
sbQuery
.
append
(
"="
);
sbQuery
.
append
(
URLEncoder
.
encode
(
query
.
getValue
(),
"utf-8"
));
}
}
}
if
(
0
<
sbQuery
.
length
())
{
sbUrl
.
append
(
"?"
).
append
(
sbQuery
);
}
}
return
sbUrl
.
toString
();
}
private
static
HttpClient
wrapClient
(
String
host
)
{
HttpClient
httpClient
=
new
DefaultHttpClient
();
if
(
host
.
startsWith
(
"https://"
))
{
sslClient
(
httpClient
);
}
return
httpClient
;
}
private
static
void
sslClient
(
HttpClient
httpClient
)
{
try
{
SSLContext
ctx
=
SSLContext
.
getInstance
(
"TLS"
);
X509TrustManager
tm
=
new
X509TrustManager
()
{
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
null
;
}
public
void
checkClientTrusted
(
X509Certificate
[]
xcs
,
String
str
)
{
}
public
void
checkServerTrusted
(
X509Certificate
[]
xcs
,
String
str
)
{
}
};
ctx
.
init
(
null
,
new
TrustManager
[]
{
tm
},
null
);
SSLSocketFactory
ssf
=
new
SSLSocketFactory
(
ctx
);
ssf
.
setHostnameVerifier
(
SSLSocketFactory
.
ALLOW_ALL_HOSTNAME_VERIFIER
);
ClientConnectionManager
ccm
=
httpClient
.
getConnectionManager
();
SchemeRegistry
registry
=
ccm
.
getSchemeRegistry
();
registry
.
register
(
new
Scheme
(
"https"
,
443
,
ssf
));
}
catch
(
KeyManagementException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
catch
(
NoSuchAlgorithmException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
}
}
\ No newline at end of file
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/Validation.java
0 → 100644
View file @
e0c44221
This diff is collapsed.
Click to expand it.
xx-universal/xx-universal-server/pom.xml
View file @
e0c44221
...
@@ -28,6 +28,44 @@
...
@@ -28,6 +28,44 @@
<artifactId>
aliyun-java-sdk-dysmsapi
</artifactId>
<artifactId>
aliyun-java-sdk-dysmsapi
</artifactId>
<version>
1.1.0
</version>
<version>
1.1.0
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
4.5.10
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpcore
</artifactId>
</dependency>
<dependency>
<groupId>
commons-lang
</groupId>
<artifactId>
commons-lang
</artifactId>
<version>
2.6
</version>
</dependency>
<dependency>
<groupId>
org.eclipse.jetty
</groupId>
<artifactId>
jetty-util
</artifactId>
<version>
9.3.7.v20160115
</version>
</dependency>
<dependency>
<groupId>
cn.hutool
</groupId>
<artifactId>
hutool-all
</artifactId>
<version>
4.5.10
</version>
</dependency>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
<artifactId>
ace-admin-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/UniversalApplication.java
View file @
e0c44221
...
@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
...
@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAceCache
@EnableAceCache
@EnableTransactionManagement
@EnableTransactionManagement
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.universal.mapper"
)
@tk
.
mybatis
.
spring
.
annotation
.
MapperScan
(
basePackages
=
"com.xxfc.platform.universal.mapper"
)
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.xxfc.platform"
})
@EnableFeignClients
({
"com.github.wxiaoqi.security.auth.client.feign"
,
"com.xxfc.platform"
,
"com.github.wxiaoqi.security.admin.feign"
})
public
class
UniversalApplication
{
public
class
UniversalApplication
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/IdInformationBiz.java
0 → 100644
View file @
e0c44221
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.universal.entity.IdInformation
;
import
com.xxfc.platform.universal.mapper.IdInformationMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-06-08 16:23
*/
@Service
@Slf4j
public
class
IdInformationBiz
extends
BaseBiz
<
IdInformationMapper
,
IdInformation
>
{
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/CertificationController.java
0 → 100644
View file @
e0c44221
package
com
.
xxfc
.
platform
.
universal
.
controller
;
import
com.alibaba.druid.util.StringUtils
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.universal.entity.IdInformation
;
import
com.xxfc.platform.universal.service.CertificationService
;
import
org.springframework.beans.factory.annotation.Autowired
;
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.servlet.http.HttpServletRequest
;
@RestController
@RequestMapping
(
"certif"
)
public
class
CertificationController
{
@Autowired
private
CertificationService
certificationService
;
@Autowired
private
UserFeign
userFeign
;
@PostMapping
(
"/str"
)
public
ObjectRestResponse
stringCertificate
(
@RequestBody
IdInformation
idInformation
,
HttpServletRequest
request
)
{
if
(
idInformation
==
null
)
{
ObjectRestResponse
.
createDefaultFail
();
}
String
token
=
request
.
getHeader
(
"Authorization"
);
if
(
StringUtils
.
isEmpty
(
token
))
{
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
RSTOKEN_NULL_CODE
,
"token为空"
);
}
//获得用户信息
ObjectRestResponse
<
UserDTO
>
userDTOObjectRestResponse
=
userFeign
.
userinfoByToken
(
token
);
if
(
userDTOObjectRestResponse
==
null
||
userDTOObjectRestResponse
.
getData
()==
null
||
userDTOObjectRestResponse
.
getData
().
getId
()==
0
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
GET_APPUSER_FAILED_CODE
,
"获取用户失败"
);
}
UserDTO
userDTO
=
userDTOObjectRestResponse
.
getData
();
idInformation
.
setUserLonginId
(
userDTO
.
getId
());
//获取用户认证信息
ObjectRestResponse
orr
=
userFeign
.
authentication
(
idInformation
.
getUserLonginId
(),
null
,
0
);
if
(
orr
==
null
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
GET_AUTH_INFO_FAILED_CODE
,
"获取用户认证信息失败"
);
}
if
(!
orr
.
getRel
()){
return
orr
;
}
Integer
am
=
idInformation
.
getAuthenticationMethods
();
Integer
type
=
idInformation
.
getCertificateType
();
if
(
type
==
0
||
am
==
0
){
return
certificationService
.
stringCertificate
(
idInformation
);
}
if
(
type
==
0
||
am
==
1
){
return
certificationService
.
imageCertificate
(
idInformation
);
}
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
SUCCESS_CODE
,
"该证件件或方式,暂时不能进行实名认证"
);
}
//
// //请求参数jsone对象后台Map接收
// //字段
// // frontImage:正面身份证照片地址,
// // backImage:反面身份证照片地址
// @PostMapping("/image")
// public ObjectRestResponse imageCertificate(@RequestBody IdInformation idInformation, HttpServletRequest request) {
//
//
// String token = request.getHeader("Authorization");
// Integer uid = certificationService.getUid(token);
//
// idInformation.setUserLonginId(uid);
//
// Map resultMap= certificationService.imageCertificate(idInformation);
// ObjectRestResponse orr = new ObjectRestResponse().rel((Boolean) resultMap.get("rel"));
//
// if (!(Boolean) resultMap.get("rel")){
// return (ObjectRestResponse) orr.data(resultMap.get("data")).msg("FAILED").status(ResultCode.FAILED_CODE);
//
// }
// return orr;
// }
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/mapper/IdInformationMapper.java
0 → 100644
View file @
e0c44221
package
com
.
xxfc
.
platform
.
universal
.
mapper
;
import
com.xxfc.platform.universal.entity.IdInformation
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Options
;
import
org.apache.ibatis.annotations.Select
;
import
org.springframework.stereotype.Repository
;
import
tk.mybatis.mapper.common.Mapper
;
@Repository
public
interface
IdInformationMapper
extends
Mapper
<
IdInformation
>
{
@Insert
(
value
=
"insert into id_information (user_login_id,name,id_number,certificate_type,front_url,back_url,expiration_date,authentication_methods) "
+
"values (#{userLonginId},#{name},#{idNumber},#{certificateType},#{frontUrl},#{backUrl},#{expirationDate},#{authenticationMethods})"
)
void
addIdInformation
(
IdInformation
idInformation
);
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/CertificationService.java
0 → 100644
View file @
e0c44221
This diff is collapsed.
Click to expand it.
xx-universal/xx-universal-server/src/main/resources/application.properties
0 → 100644
View file @
e0c44221
#\u8BA4\u8BC1\u63A5\u53E3\u9700\u8981\u643A\u5E26\u7684\u53C2\u6570
#A\u8BA4\u8BC1
certif.cHost
=
https://idcert.market.alicloudapi.com
certif.cPath
=
/idcard
certif.cMethod
=
GET
certif.cAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D\u79F0
certif.idCardName
=
idCard
#\u59D3\u540D\u5B57\u6BB5\u540D\u79F0
certif.cName
=
name
#2.\u54CD\u5E94
#\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.certifRet
=
status
#\u8BA4\u8BC1\u6210\u529F\u7801
certif.certifResultCode
=
01
#B\u56FE\u7247\u89E3\u6790
certif.iHost
=
https://ocridcard.market.alicloudapi.com
certif.iPath
=
/idimages
certif.iMethod
=
POST
certif.iAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u56FE\u7247url\u5B57\u6BB5\u540D
certif.picName
=
image
#\u65B9\u5411\u5B57\u6BB5\u540D
certif.typeName
=
idCardSide
#\u56FE\u7247\u6B63\u9762\u6807\u8BC6\u53C2\u6570
certif.frontParameter
=
front
#\u56FE\u7247\u80CC\u9762\u6807\u8BC6\u53C2\u6570
certif.backParameter
=
back
#2.\u54CD\u5E94
#\u56FE\u7247\u89E3\u6790\u54CD\u5E94\u643A\u5E26\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.imageRet
=
code
#\u56FE\u7247\u89E3\u6790\u6210\u529F\u7801
certif.imageResultCode
=
1
#\u5185\u5BB9\u5B57\u6BB5\u540D
certif.dataNam
=
result
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D
certif.numberName
=
code
#\u7528\u6237\u59D3\u540D\u5B57\u6BB5\u540D
certif.iName
=
name
#\u8EAB\u4EFD\u8BC1\u5230\u671F\u65F6\u95F4\u5B57\u6BB5\u540D
certif.expirationDateName
=
expiryDate
xx-universal/xx-universal-server/src/main/resources/mapper/IdInformationMapper.xml
0 → 100644
View file @
e0c44221
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.universal.mapper.IdInformationMapper"
>
<resultMap
type=
"com.xxfc.platform.universal.entity.IdInformation"
id=
"IdInformation"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"idNumber"
column=
"id_number"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"userLonginId"
column=
"user_login_id"
/>
<result
property=
"certificateType"
column=
"certificate_type"
/>
<result
property=
"frontUrl"
column=
"front_url"
/>
<result
property=
"backUrl"
column=
"back_url"
/>
<result
property=
"expirationDate"
column=
"expiration_date"
/>
<result
property=
"authenticationMethods"
column=
"authentication_methods"
/>
</resultMap>
</mapper>
\ No newline at end of file
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