Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-cloud-core
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-cloud-core
Commits
91807a6a
Commit
91807a6a
authored
Oct 29, 2025
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
bf6ae7d5
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
0 deletions
+45
-0
yd-common/pom.xml
+5
-0
yd-common/src/main/java/com/yd/common/enums/CommonEnum.java
+1
-0
yd-common/src/main/java/com/yd/common/utils/HttpUtil.java
+39
-0
No files found.
yd-common/pom.xml
View file @
91807a6a
...
...
@@ -64,5 +64,10 @@
<groupId>
com.ibm.icu
</groupId>
<artifactId>
icu4j
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpclient
</artifactId>
</dependency>
</dependencies>
</project>
yd-common/src/main/java/com/yd/common/enums/CommonEnum.java
View file @
91807a6a
...
...
@@ -69,6 +69,7 @@ public enum CommonEnum {
APPROVAL_STATUS_DSH
(
"DSH"
,
"待审核"
),
APPROVAL_STATUS_CG
(
"CG"
,
"审核成功"
),
APPROVAL_STATUS_SB
(
"SB"
,
"审核失败"
),
APPROVAL_STATUS_JJ
(
"JJ"
,
"拒绝"
),
//来源类型
SOURCE_TYPE_PC
(
"PC"
,
"PC"
),
...
...
yd-common/src/main/java/com/yd/common/utils/HttpUtil.java
0 → 100644
View file @
91807a6a
package
com
.
yd
.
common
.
utils
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
@Component
public
class
HttpUtil
{
private
static
final
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
public
static
String
get
(
String
url
)
throws
IOException
{
HttpGet
httpGet
=
new
HttpGet
(
url
);
try
(
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpGet
))
{
return
EntityUtils
.
toString
(
response
.
getEntity
(),
StandardCharsets
.
UTF_8
);
}
}
public
static
String
post
(
String
url
,
String
jsonBody
)
throws
IOException
{
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setHeader
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
if
(
jsonBody
!=
null
)
{
httpPost
.
setEntity
(
new
StringEntity
(
jsonBody
,
StandardCharsets
.
UTF_8
));
}
try
(
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
))
{
return
EntityUtils
.
toString
(
response
.
getEntity
(),
StandardCharsets
.
UTF_8
);
}
}
}
\ 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