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
5b9ee77e
Commit
5b9ee77e
authored
Nov 04, 2020
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改实名认证
parent
adfbd26c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
5 deletions
+92
-5
XCFQPictureParsingImpl.java
...l/service/PictureParsing/impl/XCFQPictureParsingImpl.java
+88
-3
XCFQAuthentication.java
...vice/authenticationInterface/impl/XCFQAuthentication.java
+4
-2
No files found.
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/PictureParsing/impl/XCFQPictureParsingImpl.java
View file @
5b9ee77e
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.PictureParsing.impl;
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.universal.service.PictureParsing.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.map.MapUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.xxfc.platform.universal.entity.IDCardInformation
;
import
com.xxfc.platform.universal.entity.IDCardInformation
;
...
@@ -14,7 +15,13 @@ import org.apache.http.HttpResponse;
...
@@ -14,7 +15,13 @@ import org.apache.http.HttpResponse;
import
org.apache.http.StatusLine
;
import
org.apache.http.StatusLine
;
import
org.apache.http.util.EntityUtils
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
sun.misc.BASE64Encoder
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -28,7 +35,9 @@ import java.util.Map;
...
@@ -28,7 +35,9 @@ import java.util.Map;
public
class
XCFQPictureParsingImpl
implements
UserPictureParsing
{
public
class
XCFQPictureParsingImpl
implements
UserPictureParsing
{
// private String appcode = "acea1c8811f748b3a65815f11db357c4";
// private String appcode = "acea1c8811f748b3a65815f11db357c4";
private
String
appcode2
=
"ee7710ce92054cae9f6c040f6864e6a7"
;
// private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
//潮惠玩
private
String
appcode2
=
"acea1c8811f748b3a65815f11db357c4"
;
/**
/**
* 认证相关的数据
* 认证相关的数据
...
@@ -75,7 +84,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
...
@@ -75,7 +84,7 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
}
}
private
Map
<
String
,
String
>
judgeAccordingToAnalyticalData
(
String
imageUrl
,
String
type
)
{
private
Map
<
String
,
String
>
judgeAccordingToAnalyticalData
(
String
imageUrl
,
String
type
)
{
String
json
=
imageParse
(
imageUrl
);
String
json
=
imageParse
Base64
(
imageUrl
);
log
.
info
(
"json:"
+
json
);
log
.
info
(
"json:"
+
json
);
if
(
StringUtils
.
isBlank
(
json
))
{
if
(
StringUtils
.
isBlank
(
json
))
{
...
@@ -125,6 +134,22 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
...
@@ -125,6 +134,22 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
return
null
;
return
null
;
}
}
//身份证照片解析
private
String
imageParseBase64
(
String
imageUrl
)
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
"Authorization"
,
"APPCODE "
+
appcode2
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
bodys
=
new
HashMap
<
String
,
String
>();
String
imgUrlToBase64
=
getImgUrlToBase64
(
imageUrl
);
bodys
.
put
(
"image"
,
"data:image/png;base64,"
+
imgUrlToBase64
);
try
{
return
callExternalRequest
(
headers
,
querys
,
bodys
,
1
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
return
null
;
}
private
String
callExternalRequest
(
Map
<
String
,
String
>
headers
,
private
String
callExternalRequest
(
Map
<
String
,
String
>
headers
,
Map
<
String
,
String
>
querys
,
Map
<
String
,
String
>
querys
,
...
@@ -152,4 +177,64 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
...
@@ -152,4 +177,64 @@ public class XCFQPictureParsingImpl implements UserPictureParsing {
return
null
;
return
null
;
}
}
/**
* 将网络图片转换成Base64编码字符串
*
* @param imgUrl 网络图片Url
* @return
*/
public
static
String
getImgUrlToBase64
(
String
imgUrl
)
{
InputStream
inputStream
=
null
;
ByteArrayOutputStream
outputStream
=
null
;
byte
[]
buffer
=
null
;
try
{
// 创建URL
URL
url
=
new
URL
(
imgUrl
);
// 创建链接
HttpURLConnection
conn
=
(
HttpURLConnection
)
url
.
openConnection
();
conn
.
setRequestMethod
(
"GET"
);
conn
.
setConnectTimeout
(
5000
);
inputStream
=
conn
.
getInputStream
();
outputStream
=
new
ByteArrayOutputStream
();
// 将内容读取内存中
buffer
=
new
byte
[
1024
];
int
len
=
-
1
;
while
((
len
=
inputStream
.
read
(
buffer
))
!=
-
1
)
{
outputStream
.
write
(
buffer
,
0
,
len
);
}
buffer
=
outputStream
.
toByteArray
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
inputStream
!=
null
)
{
try
{
// 关闭inputStream流
inputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
if
(
outputStream
!=
null
)
{
try
{
// 关闭outputStream流
outputStream
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
// 对字节数组Base64编码
String
str
=
new
BASE64Encoder
().
encode
(
buffer
);
if
(
StrUtil
.
isNotBlank
(
str
))
{
str
=
str
.
replaceAll
(
"\n"
,
""
);
}
return
str
;
}
public
static
void
main
(
String
[]
args
)
{
String
str
=
getImgUrlToBase64
(
"http://xxtest.upyuns.com/image/app/2020-10-19/3.jpg"
);
//str = str.replaceAll("\n","");
System
.
out
.
println
(
str
);
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/authenticationInterface/impl/XCFQAuthentication.java
View file @
5b9ee77e
...
@@ -27,8 +27,10 @@ import java.util.Map;
...
@@ -27,8 +27,10 @@ import java.util.Map;
@Primary
@Primary
public
class
XCFQAuthentication
implements
UserAuthentication
{
public
class
XCFQAuthentication
implements
UserAuthentication
{
// private String appcode="acea1c8811f748b3a65815f11db357c4";
// private String appcode="acea1c8811f748b3a65815f11db357c4";
private
String
appcode2
=
"ee7710ce92054cae9f6c040f6864e6a7"
;
// private String appcode2 = "ee7710ce92054cae9f6c040f6864e6a7";
//潮惠玩
private
String
appcode2
=
"acea1c8811f748b3a65815f11db357c4"
;
/**
/**
* 认证相关的数据
* 认证相关的数据
...
...
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