Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
customer-service
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
QG
customer-service
Commits
f9ee4bf5
Commit
f9ee4bf5
authored
Oct 16, 2020
by
鹿朋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
结清证明
parent
cf152f00
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
+19
-7
IHttpService.java
...ava/cn/quantgroup/customer/service/http/IHttpService.java
+1
-0
RestTemplateServiceImpl.java
...tgroup/customer/service/http/RestTemplateServiceImpl.java
+14
-0
IceServiceImpl.java
...a/cn/quantgroup/customer/service/impl/IceServiceImpl.java
+4
-7
No files found.
src/main/java/cn/quantgroup/customer/service/http/IHttpService.java
View file @
f9ee4bf5
...
@@ -45,6 +45,7 @@ public interface IHttpService {
...
@@ -45,6 +45,7 @@ public interface IHttpService {
* @return
* @return
*/
*/
String
get
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
?>
parameters
);
String
get
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
?>
parameters
);
byte
[]
getByte
(
String
uri
,
Map
<
String
,
String
>
headers
,
Map
<
String
,
?>
parameters
);
/**
/**
* Http Post
* Http Post
...
...
src/main/java/cn/quantgroup/customer/service/http/RestTemplateServiceImpl.java
View file @
f9ee4bf5
...
@@ -88,6 +88,20 @@ public class RestTemplateServiceImpl implements IHttpService {
...
@@ -88,6 +88,20 @@ public class RestTemplateServiceImpl implements IHttpService {
return
builder
.
toString
();
return
builder
.
toString
();
}
}
@Override
public
byte
[]
getByte
(
String
uri
,
Map
<
String
,
String
>
hs
,
Map
<
String
,
?>
parameters
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
hs
.
forEach
((
k
,
v
)
->
{
headers
.
add
(
k
,
v
);
});
HttpEntity
<?>
en
=
new
HttpEntity
<>(
headers
);
ResponseEntity
<
byte
[]>
entity
=
restTemplate
.
exchange
(
buildUrl
(
uri
,
parameters
),
HttpMethod
.
GET
,
en
,
byte
[].
class
,
parameters
);
if
(
entity
.
getStatusCode
().
is2xxSuccessful
())
{
return
entity
.
getBody
();
}
throw
new
HttpClientErrorException
(
entity
.
getStatusCode
());
}
@Override
@Override
public
String
get
(
String
uri
,
Map
<
String
,
String
>
hs
,
Map
<
String
,
?>
parameters
)
{
public
String
get
(
String
uri
,
Map
<
String
,
String
>
hs
,
Map
<
String
,
?>
parameters
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
...
...
src/main/java/cn/quantgroup/customer/service/impl/IceServiceImpl.java
View file @
f9ee4bf5
...
@@ -226,22 +226,19 @@ public class IceServiceImpl implements IIceService {
...
@@ -226,22 +226,19 @@ public class IceServiceImpl implements IIceService {
Map
<
String
,
String
>
header
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
header
=
Maps
.
newHashMap
();
header
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
header
.
put
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
String
result
;
byte
[]
result
;
try
{
try
{
result
=
httpService
.
get
(
url
,
header
,
param
);
result
=
httpService
.
get
Byte
(
url
,
header
,
param
);
log
.
info
(
"{} 结清证明下载 loanId={},result:{}"
,
logPre
,
loanId
,
result
);
log
.
info
(
"{} 结清证明下载 loanId={},result:{}"
,
logPre
,
loanId
,
result
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"{} 通讯异常 url={},param={}"
,
logPre
,
url
,
param
,
e
);
log
.
error
(
"{} 通讯异常 url={},param={}"
,
logPre
,
url
,
param
,
e
);
return
JsonResult
.
buildErrorStateResult
(
"通讯异常"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"通讯异常"
,
null
);
}
}
if
(
StringUtils
.
isBlank
(
result
)
)
{
if
(
result
.
length
<=
0
)
{
log
.
error
(
"{} 调用失败 url={}, header={},param={},result={}"
,
logPre
,
url
,
header
,
param
,
result
);
log
.
error
(
"{} 调用失败 url={}, header={},param={},result={}"
,
logPre
,
url
,
header
,
param
,
result
);
return
JsonResult
.
buildErrorStateResult
(
"结清证明下载失败"
,
null
);
return
JsonResult
.
buildErrorStateResult
(
"结清证明下载失败"
,
null
);
}
}
TypeReference
<
JsonResult
>
typeToken
=
new
TypeReference
<
JsonResult
>()
{
return
fileService
.
outputFile
(
response
,
System
.
currentTimeMillis
()
+
String
.
valueOf
(
loanId
)
+
"settle.pdf"
,
result
);
};
JsonResult
<
byte
[]>
jsonResult
=
JSONTools
.
deserialize
(
result
,
typeToken
);
return
fileService
.
outputFile
(
response
,
System
.
currentTimeMillis
()
+
loanId
+
"settle.pdf"
,
jsonResult
.
getData
());
}
}
}
}
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