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
b848f47d
Commit
b848f47d
authored
Mar 26, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
单个任务调用第三方接口 See merge request
!223
parents
1dc673a7
f25b0ce5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
4 deletions
+72
-4
TestRecordsService.java
...w/src/main/java/com/ruoyi/service/TestRecordsService.java
+7
-0
TestRecordsServiceImpl.java
...n/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
+64
-3
TestRecordsMapper.xml
...ty-review/src/main/resources/mapper/TestRecordsMapper.xml
+1
-1
No files found.
quality-review/src/main/java/com/ruoyi/service/TestRecordsService.java
View file @
b848f47d
...
@@ -19,4 +19,11 @@ public interface TestRecordsService extends IService<TestRecords> {
...
@@ -19,4 +19,11 @@ public interface TestRecordsService extends IService<TestRecords> {
* @param id
* @param id
*/
*/
void
sendPost
(
String
id
,
Long
taskId
);
void
sendPost
(
String
id
,
Long
taskId
);
/**
* 单个任务发送请求
* @param id
* @param taskId
*/
void
singleSendPost
(
String
id
,
Long
taskId
);
}
}
quality-review/src/main/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
View file @
b848f47d
...
@@ -49,12 +49,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -49,12 +49,12 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
List
<
TestRecords
>
recordsList
=
testRecordsService
.
findByTaskId
(
id
);
List
<
TestRecords
>
recordsList
=
testRecordsService
.
findByTaskId
(
id
);
List
<
TestRecords
>
list
=
new
ArrayList
<>();
List
<
TestRecords
>
list
=
new
ArrayList
<>();
if
(
caseResultVOS
.
size
()
!=
0
&&
caseResultVOS
!=
null
)
{
if
(
caseResultVOS
!=
null
&&
caseResultVOS
.
size
()
!=
0
)
{
for
(
CaseResultVO
caseResultVO
:
caseResultVOS
)
{
for
(
CaseResultVO
caseResultVO
:
caseResultVOS
)
{
// 检查 usecaseId 是否在 recordsList 中存在
// 检查 usecaseId 是否在 recordsList 中存在
boolean
exists
=
false
;
boolean
exists
=
false
;
if
(
recordsList
.
size
()
!=
0
&&
recordsList
!=
null
)
{
if
(
recordsList
!=
null
&&
recordsList
.
size
()
!=
0
)
{
for
(
TestRecords
records
:
recordsList
)
{
for
(
TestRecords
records
:
recordsList
)
{
if
(
Objects
.
equals
(
caseResultVO
.
getId
(),
records
.
getUsecaseId
()))
{
if
(
Objects
.
equals
(
caseResultVO
.
getId
(),
records
.
getUsecaseId
()))
{
...
@@ -78,7 +78,68 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
...
@@ -78,7 +78,68 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
// 用例步骤
// 用例步骤
List
<
StepResultVO
>
stepResultVOS
=
caseResultVO
.
getStep_result_list
();
List
<
StepResultVO
>
stepResultVOS
=
caseResultVO
.
getStep_result_list
();
if
(
stepResultVOS
.
size
()
!=
0
&&
stepResultVOS
!=
null
)
{
if
(
stepResultVOS
!=
null
&&
stepResultVOS
.
size
()
!=
0
)
{
List
<
String
>
stepList
=
new
ArrayList
<>();
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
String
stepName
=
stepResultVO
.
getName
();
stepList
.
add
(
stepName
);
}
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
","
));
}
list
.
add
(
testRecords
);
}
}
testRecordsService
.
saveBatch
(
list
);
}
}
@Override
public
void
singleSendPost
(
String
id
,
Long
taskId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
map
.
put
(
"verbose"
,
"ALL"
);
//以post形式请求接口
String
result
=
HttpUtil
.
post
(
"https://10.12.48.78:8090/DescribeProjectTestResult"
,
JSONObject
.
toJSONString
(
map
));
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
result
);
// 获取项目id
String
projectId
=
(
String
)
jsonObject
.
get
(
"id"
);
// 获取项目用例结果列表
List
<
CaseResultVO
>
caseResultVOS
=
jsonObject
.
getList
(
"case_result_list"
,
CaseResultVO
.
class
);
// 获取当前任务本地存储的列表
List
<
TestRecords
>
recordsList
=
testRecordsService
.
findByTaskId
(
id
);
if
(
recordsList
!=
null
&&
recordsList
.
size
()
!=
0
)
{
testRecordsService
.
removeBatchByIds
(
recordsList
);
}
List
<
TestRecords
>
list
=
new
ArrayList
<>();
if
(
caseResultVOS
!=
null
&&
caseResultVOS
.
size
()
!=
0
)
{
for
(
CaseResultVO
caseResultVO
:
caseResultVOS
)
{
if
(
Objects
.
equals
(
caseResultVO
.
getStatus
(),
"PASSED"
)
||
Objects
.
equals
(
caseResultVO
.
getStatus
(),
"FAILED"
))
{
TestRecords
testRecords
=
new
TestRecords
();
testRecords
.
setProjectId
(
projectId
);
testRecords
.
setTaskId
(
taskId
);
testRecords
.
setUsecase
(
caseResultVO
.
getName
());
testRecords
.
setUsecaseId
(
caseResultVO
.
getId
());
testRecords
.
setDescription
(
caseResultVO
.
getDescription
());
testRecords
.
setRiskLevel
(
caseResultVO
.
getRisk_level
());
testRecords
.
setTestResult
(
caseResultVO
.
getStatus
());
testRecords
.
setRemediation
(
caseResultVO
.
getRemediation
());
// 用例步骤
List
<
StepResultVO
>
stepResultVOS
=
caseResultVO
.
getStep_result_list
();
if
(
stepResultVOS
!=
null
&&
stepResultVOS
.
size
()
!=
0
)
{
List
<
String
>
stepList
=
new
ArrayList
<>();
List
<
String
>
stepList
=
new
ArrayList
<>();
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
for
(
StepResultVO
stepResultVO
:
stepResultVOS
)
{
String
stepName
=
stepResultVO
.
getName
();
String
stepName
=
stepResultVO
.
getName
();
...
...
quality-review/src/main/resources/mapper/TestRecordsMapper.xml
View file @
b848f47d
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<select
id=
"findByTaskId"
resultType=
"com.ruoyi.domain.TestRecords"
>
<select
id=
"findByTaskId"
resultType=
"com.ruoyi.domain.TestRecords"
>
SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation
SELECT id, project_id, task_id, usecase, usecase_id, test_time, description, risk_level, test_method, test_result, remediation
FROM t_test_records
FROM t_test_records
WHERE
task
_id = #{id}
WHERE
project
_id = #{id}
</select>
</select>
...
...
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