Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
InternalLogic
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CrossProvincialPlatform
InternalLogic
Commits
ff36fb7b
Commit
ff36fb7b
authored
Sep 28, 2023
by
张俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
9191b2e8
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
187 deletions
+36
-187
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
...j/adapter/controller/ProvidentFundServicesController.java
+28
-176
src/main/java/net/cdkj/gjj/adapter/utils/HttpUtil.java
src/main/java/net/cdkj/gjj/adapter/utils/HttpUtil.java
+8
-11
No files found.
src/main/java/net/cdkj/gjj/adapter/controller/ProvidentFundServicesController.java
View file @
ff36fb7b
This diff is collapsed.
Click to expand it.
src/main/java/net/cdkj/gjj/adapter/utils/HttpUtil.java
View file @
ff36fb7b
...
@@ -31,7 +31,7 @@ public class HttpUtil {
...
@@ -31,7 +31,7 @@ public class HttpUtil {
/**
/**
* 发起 post 请求
,并对出参进行解压缩
* 发起 post 请求
*/
*/
public
static
String
sendPost
(
String
httpUrl
,
String
content
)
{
public
static
String
sendPost
(
String
httpUrl
,
String
content
)
{
StringBuffer
sb
=
new
StringBuffer
();
StringBuffer
sb
=
new
StringBuffer
();
...
@@ -54,8 +54,6 @@ public class HttpUtil {
...
@@ -54,8 +54,6 @@ public class HttpUtil {
conn
.
setRequestProperty
(
"Connection"
,
"Keep-Alive"
);
conn
.
setRequestProperty
(
"Connection"
,
"Keep-Alive"
);
// 设置文件类型:
// 设置文件类型:
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
conn
.
setRequestProperty
(
"Content-Type"
,
"application/json"
);
conn
.
setRequestProperty
(
"accept"
,
"*/*"
);
conn
.
setRequestProperty
(
"Accept-Encoding"
,
"gzip, deflate, br"
);
// 设置文件字符集:
// 设置文件字符集:
conn
.
setRequestProperty
(
"Charset"
,
"UTF-8"
);
conn
.
setRequestProperty
(
"Charset"
,
"UTF-8"
);
// 转换为字节数组
// 转换为字节数组
...
@@ -69,16 +67,15 @@ public class HttpUtil {
...
@@ -69,16 +67,15 @@ public class HttpUtil {
out
.
write
(
data
);
out
.
write
(
data
);
// 请求返回的状态
// 请求返回的状态
if
(
HttpURLConnection
.
HTTP_OK
==
conn
.
getResponseCode
())
{
if
(
HttpURLConnection
.
HTTP_OK
==
conn
.
getResponseCode
())
{
// 请求返回的数据
,解压缩
// 请求返回的数据
InputStream
is
=
conn
.
getInputStream
();
InputStream
is
=
conn
.
getInputStream
();
GZIPInputStream
gzis
=
new
GZIPInputStream
(
is
);
String
readLine
=
new
String
();
InputStreamReader
reader
=
new
InputStreamReader
(
gzis
,
"UTF-8"
);
BufferedReader
responseReader
=
new
BufferedReader
(
new
InputStreamReader
(
is
,
"UTF-8"
));
BufferedReader
br
=
new
BufferedReader
(
reader
);
while
((
readLine
=
responseReader
.
readLine
())
!=
null
)
{
String
temp
;
sb
.
append
(
readLine
);
while
((
temp
=
br
.
readLine
())
!=
null
)
{
sb
.
append
(
temp
);
}
}
System
.
out
.
println
(
"第三方返回的zip解压缩之后的报文:"
+
sb
);
responseReader
.
close
();
System
.
out
.
println
(
"前置机返回第三方解压之后数据:"
+
sb
);
return
sb
.
toString
();
return
sb
.
toString
();
}
else
{
}
else
{
System
.
out
.
println
(
"请求失败!!!"
);
System
.
out
.
println
(
"请求失败!!!"
);
...
...
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