Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
QA
qa-platform
Commits
1416a0ea
Commit
1416a0ea
authored
Nov 17, 2020
by
黎博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复jar包里获取不到文件
parent
983bab95
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
Vcc.java
src/main/java/cn/qg/qaplatform/process/Vcc.java
+11
-9
No files found.
src/main/java/cn/qg/qaplatform/process/Vcc.java
View file @
1416a0ea
...
...
@@ -8,22 +8,24 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ResourceUtils
;
import
springfox.documentation.spring.web.json.Json
;
import
org.springframework.core.io.ClassPathResource
;
import
java.io.*
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStreamReader
;
import
java.net.URISyntaxException
;
import
java.net.URLEncoder
;
import
java.sql.SQLException
;
import
java.util.HashMap
;
import
java.util.Map
;
@Slf4j
public
class
Vcc
{
public
static
String
readTxt
(
File
file
)
throws
IOException
{
public
static
String
readTxt
(
String
file
)
throws
IOException
{
String
str
=
""
;
InputStreamReader
in
=
new
InputStreamReader
(
new
FileInputStream
(
file
),
"UTF-8"
);
BufferedReader
br
=
new
BufferedReader
(
in
);
ClassPathResource
resource
=
new
ClassPathResource
(
file
);
InputStream
in
=
resource
.
getInputStream
();
BufferedReader
br
=
new
BufferedReader
(
new
InputStreamReader
(
in
));
StringBuffer
content
=
new
StringBuffer
();
while
((
str
=
br
.
readLine
())
!=
null
)
{
content
=
content
.
append
(
str
);
...
...
@@ -95,7 +97,7 @@ public class Vcc {
map
.
put
(
"msg"
,
"OCR获取成功"
);
map
.
put
(
"name"
,
"张三"
);
map
.
put
(
"sex"
,
"男"
);
String
frontBase64Str
=
Vcc
.
readTxt
(
ResourceUtils
.
getFile
(
"classpath:front.txt"
)
);
String
frontBase64Str
=
Vcc
.
readTxt
(
"front.txt"
);
map
.
put
(
"base64Str"
,
frontBase64Str
);
params
.
put
(
"idCard"
,
JSON
.
toJSONString
(
map
));
JSONObject
result
=
HttpClientUtils
.
doPost
(
url
,
params
,
headers
);
...
...
@@ -124,7 +126,7 @@ public class Vcc {
map
.
put
(
"type"
,
"xyqb"
);
map
.
put
(
"warning"
,
"00010000"
);
map
.
put
(
"multiWarning"
,
"00010000"
);
String
backBase64Str
=
Vcc
.
readTxt
(
ResourceUtils
.
getFile
(
"classpath:back.txt"
)
);
String
backBase64Str
=
Vcc
.
readTxt
(
"back.txt"
);
map
.
put
(
"base64Str"
,
backBase64Str
);
params
.
put
(
"idCard"
,
JsonTransUtils
.
mapToJson
(
map
));
JSONObject
result
=
HttpClientUtils
.
doPost
(
url
,
params
,
headers
);
...
...
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