Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
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
王飞
vehicle-quality-review
Commits
b66dd431
Commit
b66dd431
authored
Jul 04, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
调用接口 See merge request
!401
parents
169b0865
a817d8c0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
TestDownload.java
ruoyi-admin/src/test/java/com/ruoyi/TestDownload.java
+47
-0
TestRecordsTest.java
ruoyi-admin/src/test/java/com/ruoyi/TestRecordsTest.java
+2
-2
No files found.
ruoyi-admin/src/test/java/com/ruoyi/TestDownload.java
0 → 100644
View file @
b66dd431
package
com
.
ruoyi
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
org.junit.jupiter.api.Test
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
TestDownload
{
@Test
public
void
test
()
{
try
{
// 直接使用URL作为POST请求的目标,假设所有需要的信息已包含在URL中
HttpResponse
response
=
HttpRequest
.
post
(
"https://10.12.48.78:8090/api/project/download"
+
"/fd40de37-9c57-4597-8f74-d0754dfa17b2"
)
// 如果需要添加特定的请求头,如认证信息,可以在这里添加
//.header("Authorization", "Bearer your_token_here")
.
execute
();
// 检查响应是否成功
if
(
response
.
isOk
())
{
System
.
out
.
println
(
"response = "
+
response
);
// 获取文件名,这里简化处理,实际情况可能需要从响应头中解析(如Content-Disposition)
// String fileName = "downloaded_file_from_post.zip";
//
// // 保存到本地
// FileUtil.writeBytes(IoUtil.readBytes(response.bodyStream()), FileUtil.file(fileName));
//
// System.out.println("文件下载成功:" + fileName);
}
else
{
System
.
err
.
println
(
"下载失败,状态码:"
+
response
.
getStatus
());
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
//以post形式请求接口
// String result= HttpUtil.post("https://10.12.48.78:8090/api/project/download","/fd40de37-9c57-4597-8f74-d0754dfa17b2");
}
}
ruoyi-admin/src/test/java/com/ruoyi/TestRecordsTest.java
View file @
b66dd431
...
@@ -28,7 +28,7 @@ public class TestRecordsTest {
...
@@ -28,7 +28,7 @@ public class TestRecordsTest {
public
void
test
()
{
public
void
test
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
"
project_items;27
"
);
map
.
put
(
"id"
,
"
5wU7nij8QomtoGMVhoxQjryw8hncJ
"
);
map
.
put
(
"verbose"
,
"ALL"
);
map
.
put
(
"verbose"
,
"ALL"
);
//以post形式请求接口
//以post形式请求接口
...
@@ -43,7 +43,7 @@ public class TestRecordsTest {
...
@@ -43,7 +43,7 @@ public class TestRecordsTest {
List
<
CaseResultVO
>
caseResultVOS
=
jsonObject
.
getList
(
"case_result_list"
,
CaseResultVO
.
class
);
List
<
CaseResultVO
>
caseResultVOS
=
jsonObject
.
getList
(
"case_result_list"
,
CaseResultVO
.
class
);
// 获取本地存储的列表
// 获取本地存储的列表
List
<
TestRecords
>
recordsList
=
testRecordsService
.
findByTaskId
(
"
project_items;29
"
);
List
<
TestRecords
>
recordsList
=
testRecordsService
.
findByTaskId
(
"
5wU7nij8QomtoGMVhoxQjryw8hncJ
"
);
List
<
TestRecords
>
list
=
new
ArrayList
<>();
List
<
TestRecords
>
list
=
new
ArrayList
<>();
if
(
caseResultVOS
.
size
()
!=
0
&&
caseResultVOS
!=
null
)
{
if
(
caseResultVOS
.
size
()
!=
0
&&
caseResultVOS
!=
null
)
{
...
...
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