Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
car-database-api
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
中汽研标准应用数据库
car-database-api
Commits
1ff7a1c2
Commit
1ff7a1c2
authored
Sep 12, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'master'
获取所有测试用例编号 See merge request
!12
parents
d1fe7f04
3f9a9394
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
0 deletions
+77
-0
TestUseCaseService.java
...w/src/main/java/com/ruoyi/service/TestUseCaseService.java
+7
-0
TestUseCaseServiceImpl.java
...n/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
+43
-0
TestUserCaseController.java
...w/src/main/java/com/ruoyi/web/TestUserCaseController.java
+11
-0
SerialNumberResponse.java
...ain/java/com/ruoyi/web/response/SerialNumberResponse.java
+16
-0
No files found.
quality-review/src/main/java/com/ruoyi/service/TestUseCaseService.java
View file @
1ff7a1c2
...
...
@@ -103,4 +103,11 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @return
*/
NewTestUserCaseListResponse
getCaseListNew
(
String
request
)
throws
IOException
;
/**
* 获取测试用例编号数组(科恩)
* @param request
* @return
*/
List
<
SerialNumberResponse
>
getSerialNumberList
(
String
request
)
throws
IOException
;
}
quality-review/src/main/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
View file @
1ff7a1c2
...
...
@@ -408,6 +408,49 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
return
caseResponse
;
}
@Override
public
List
<
SerialNumberResponse
>
getSerialNumberList
(
String
request
)
throws
IOException
{
List
<
SerialNumberResponse
>
serialNumberList
=
new
ArrayList
<>();
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
().
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
"{\"query\":\"query regulationAllUseCases($offset:OffsetConnectionInput$name: String!){regulationByName(name:$name){items(offset:$offset){ nodes{id serialNumber requirements useCases{id customizedID description}}totalCount}}}\",\"variables\":"
+
request
+
"}"
);
Request
requestKE
=
new
Request
.
Builder
()
.
url
(
"http://10.12.48.80:8089/api/query"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
// TODO 连接
.
addHeader
(
"Authorization"
,
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjAsInRva2VuaWQiOjYxLCJ0eXBlIjoiYXBpIiwidXNlcm5hbWUiOiJhZG1pbiJ9.48Ggjx-FtOcecf73vAHn0XglwgLXZlfXxhXiLDHWWQE"
)
// .addHeader("Host", "10.12.48.80:8089")
// .addHeader("Origin", "http://10.12.48.80:8089")
// .addHeader("Referer", "http://10.12.48.80:8089/api/graphql/playground")
// .addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
.
build
();
Response
response
=
client
.
newCall
(
requestKE
).
execute
();
String
string
=
response
.
body
().
string
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
// 获取测试用例
if
(
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
)
!=
null
)
{
List
<
StandardNewVO
>
list
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getJSONObject
(
"items"
).
getList
(
"nodes"
,
StandardNewVO
.
class
);
SerialNumberResponse
numberResponse
=
new
SerialNumberResponse
();
for
(
StandardNewVO
vo
:
list
)
{
for
(
UseCaseNewVO
useCaseNewVO
:
vo
.
getUseCases
())
{
numberResponse
.
setId
(
useCaseNewVO
.
getId
());
numberResponse
.
setSerialNumber
(
vo
.
getSerialNumber
());
serialNumberList
.
add
(
numberResponse
);
}
}
}
return
serialNumberList
;
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/TestUserCaseController.java
View file @
1ff7a1c2
...
...
@@ -153,4 +153,15 @@ public class TestUserCaseController extends BaseController{
}
@ApiOperation
(
"获取测试用例编号数组(科恩)"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getSerialNumberList"
,
produces
=
"application/json;charset=UTF-8"
)
public
TableDataInfo
<
SerialNumberResponse
>
getSerialNumberList
(
@Validated
@RequestBody
String
request
)
throws
IOException
{
List
<
SerialNumberResponse
>
list
=
testUseCaseService
.
getSerialNumberList
(
request
);
return
getDataTable
(
list
);
}
}
quality-review/src/main/java/com/ruoyi/web/response/SerialNumberResponse.java
0 → 100644
View file @
1ff7a1c2
package
com
.
ruoyi
.
web
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"SerialNumberResponse"
,
description
=
"查询测试用例编号"
)
@Data
public
class
SerialNumberResponse
{
@ApiModelProperty
(
"用例id"
)
private
String
id
;
@ApiModelProperty
(
"用例编号"
)
private
String
serialNumber
;
}
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