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
89b6b7d3
Commit
89b6b7d3
authored
Apr 25, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangdingyi' into 'dev'
检验内容库查询车型试验(科恩) & 查询测试用例分页查询(科恩) See merge request
!307
parents
abf0eb91
bf0e181b
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
334 additions
and
15 deletions
+334
-15
InspectionContentVO.java
...rc/main/java/com/ruoyi/domain/vo/InspectionContentVO.java
+22
-0
UseCaseUrlVO.java
...eview/src/main/java/com/ruoyi/domain/vo/UseCaseUrlVO.java
+23
-0
BaseEnum.java
quality-review/src/main/java/com/ruoyi/enums/BaseEnum.java
+34
-0
UseCaseRiskLevelEnum.java
...w/src/main/java/com/ruoyi/enums/UseCaseRiskLevelEnum.java
+32
-0
ReviewStandardService.java
...rc/main/java/com/ruoyi/service/ReviewStandardService.java
+9
-0
TestUseCaseService.java
...w/src/main/java/com/ruoyi/service/TestUseCaseService.java
+11
-0
ReviewStandardServiceImpl.java
...ava/com/ruoyi/service/impl/ReviewStandardServiceImpl.java
+46
-0
TestUseCaseServiceImpl.java
...n/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
+46
-0
ReviewStandardController.java
...src/main/java/com/ruoyi/web/ReviewStandardController.java
+17
-0
TestUserCaseController.java
...w/src/main/java/com/ruoyi/web/TestUserCaseController.java
+20
-0
InspectionContentResponse.java
...ava/com/ruoyi/web/response/InspectionContentResponse.java
+19
-0
TestUserCaseListResponse.java
...java/com/ruoyi/web/response/TestUserCaseListResponse.java
+7
-15
TestUrl.java
ruoyi-admin/src/test/java/com/ruoyi/TestUrl.java
+48
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/InspectionContentVO.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
.
domain
.
vo
;
import
lombok.Data
;
@Data
/**
* 车型试验VO
*/
public
class
InspectionContentVO
{
// id
private
String
id
;
// 标准章节
private
String
serialNumber
;
// 标准要求
private
String
requirements
;
// 标准测试方法
private
String
testMethod
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/UseCaseUrlVO.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
.
domain
.
vo
;
import
lombok.Data
;
@Data
/**
* 测试用例VO
*/
public
class
UseCaseUrlVO
{
// 用例编号
private
String
displayID
;
// 用例名称
private
String
name
;
// 用例描述
private
String
description
;
// 对应输入
private
String
requirements
;
}
quality-review/src/main/java/com/ruoyi/enums/BaseEnum.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
.
enums
;
import
com.baomidou.mybatisplus.annotation.IEnum
;
import
java.io.Serializable
;
/**
* 基础枚举 接口
* @author YangAo
*/
public
interface
BaseEnum
<
T
extends
Serializable
>
extends
IEnum
<
T
>
{
/**
* 获取描述
*
* @return 描述
*/
String
getDesc
();
/**
* 根据值获取枚举
*
* @param value 值
* @return 枚举
*/
static
<
T
extends
Serializable
>
BaseEnum
<
T
>
getEnumByValue
(
T
value
,
Class
<?
extends
BaseEnum
<
T
>>
clazz
)
{
for
(
BaseEnum
<
T
>
code
:
clazz
.
getEnumConstants
())
{
if
(
code
.
getValue
().
equals
(
value
))
{
return
code
;
}
}
return
null
;
}
}
quality-review/src/main/java/com/ruoyi/enums/UseCaseRiskLevelEnum.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
.
enums
;
import
com.fasterxml.jackson.annotation.JsonValue
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@Getter
@AllArgsConstructor
public
enum
UseCaseRiskLevelEnum
implements
BaseEnum
<
String
>
{
HIGH
(
"HIGH"
,
"高危"
),
MEDIUM
(
"MEDIUM"
,
"中危"
),
GRADUATE
(
"GRADUATE"
,
"低危"
),
UNKNOWN
(
"UNKNOWN"
,
"无"
);
/**
* 枚举值
*/
@JsonValue
private
final
String
value
;
/**
* 枚举描述
*/
private
final
String
desc
;
}
quality-review/src/main/java/com/ruoyi/service/ReviewStandardService.java
View file @
89b6b7d3
...
@@ -8,6 +8,7 @@ import com.ruoyi.web.request.ReviewStandardListRequest;
...
@@ -8,6 +8,7 @@ import com.ruoyi.web.request.ReviewStandardListRequest;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.response.*
;
import
com.ruoyi.web.response.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
public
interface
ReviewStandardService
extends
IService
<
ReviewStandard
>
{
public
interface
ReviewStandardService
extends
IService
<
ReviewStandard
>
{
...
@@ -70,4 +71,12 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
...
@@ -70,4 +71,12 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* @param request
* @param request
*/
*/
void
saveStandardUsecase
(
ReviewStandardSaveStandardUsecaseRequest
request
);
void
saveStandardUsecase
(
ReviewStandardSaveStandardUsecaseRequest
request
);
/**
* 检验内容库科恩获取车型试验
* @param request
* @return
* @throws IOException
*/
InspectionContentResponse
getList
(
String
request
)
throws
IOException
;
}
}
quality-review/src/main/java/com/ruoyi/service/TestUseCaseService.java
View file @
89b6b7d3
...
@@ -5,8 +5,11 @@ import com.ruoyi.domain.TestUseCase;
...
@@ -5,8 +5,11 @@ import com.ruoyi.domain.TestUseCase;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -45,4 +48,12 @@ public interface TestUseCaseService extends IService<TestUseCase> {
...
@@ -45,4 +48,12 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @return
* @return
*/
*/
JSONObject
callThirdPartyInterface
(
String
url
,
Map
<
String
,
Object
>
map
);
JSONObject
callThirdPartyInterface
(
String
url
,
Map
<
String
,
Object
>
map
);
/**
* 科恩获取测试用例
* @param request
* @return
* @throws IOException
*/
TestUserCaseListResponse
getUseCaseList
(
String
request
)
throws
IOException
;
}
}
quality-review/src/main/java/com/ruoyi/service/impl/ReviewStandardServiceImpl.java
View file @
89b6b7d3
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.domain.vo.InspectionContentVO
;
import
com.ruoyi.domain.vo.OptionalUseCasesVO
;
import
com.ruoyi.domain.vo.OptionalUseCasesVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.web.request.ReviewFindListRequest
;
import
com.ruoyi.web.request.ReviewFindListRequest
;
...
@@ -14,10 +17,12 @@ import com.ruoyi.web.request.ReviewStandardListByPageRequest;
...
@@ -14,10 +17,12 @@ import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import
com.ruoyi.web.request.ReviewStandardListRequest
;
import
com.ruoyi.web.request.ReviewStandardListRequest
;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.response.*
;
import
com.ruoyi.web.response.*
;
import
okhttp3.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -184,6 +189,47 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
...
@@ -184,6 +189,47 @@ public class ReviewStandardServiceImpl extends ServiceImpl<ReviewStandardMapper,
}
}
}
}
/**
* 检验内容库科恩获取车型试验
* @param request
* @return
* @throws IOException
*/
@Override
public
InspectionContentResponse
getList
(
String
request
)
throws
IOException
{
InspectionContentResponse
inspectionContentResponse
=
new
InspectionContentResponse
();
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
().
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
"{\"query\":\"query regulationItems($name:String!$offset:OffsetConnectionInput$orderBy:OrderByInput){regulationByName(name:$name){items(offset:$offset orderBy:$orderBy){totalCount nodes{id serialNumber requirements testMethod}}}}\",\"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("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
);
// 获取测试用例
List
<
InspectionContentVO
>
list
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getJSONObject
(
"items"
).
getList
(
"nodes"
,
InspectionContentVO
.
class
);
inspectionContentResponse
.
setInspectionContent
(
list
);
// 获取总条数
Integer
totalCount
=
(
Integer
)
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getJSONObject
(
"items"
).
get
(
"totalCount"
);
inspectionContentResponse
.
setTotalCount
(
totalCount
);
return
inspectionContentResponse
;
}
/**
/**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList
* @param reviewStandardList
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
View file @
89b6b7d3
...
@@ -6,15 +6,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...
@@ -6,15 +6,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.vo.CaseResultVO
;
import
com.ruoyi.domain.vo.CaseResultVO
;
import
com.ruoyi.domain.vo.TestUsecaseVO
;
import
com.ruoyi.domain.vo.TestUsecaseVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.mapper.TestUseCaseMapper
;
import
com.ruoyi.mapper.TestUseCaseMapper
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
okhttp3.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -88,6 +92,48 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
...
@@ -88,6 +92,48 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
return
JSONObject
.
parseObject
(
result
);
return
JSONObject
.
parseObject
(
result
);
}
}
/**
* 科恩获取测试用例
* @param request
* @return
* @throws IOException
*/
@Override
public
TestUserCaseListResponse
getUseCaseList
(
String
request
)
throws
IOException
{
TestUserCaseListResponse
userCaseResponse
=
new
TestUserCaseListResponse
();
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
().
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
"{\"query\":\"query useCases($offset:OffsetConnectionInput$orderBy:OrderByInput$filter:Map$search:String){useCases(offset:$offset orderBy:$orderBy filterFields:$filter search:$search){nodes{id displayID class name description remediation requirements riskLevel}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("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
);
// 获取测试用例
List
<
UseCaseUrlVO
>
list
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"useCases"
).
getList
(
"nodes"
,
UseCaseUrlVO
.
class
);
userCaseResponse
.
setUseCases
(
list
);
// 获取总条数
Integer
totalCount
=
(
Integer
)
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"useCases"
).
get
(
"totalCount"
);
userCaseResponse
.
setTotalCount
(
totalCount
);
return
userCaseResponse
;
}
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/ReviewStandardController.java
View file @
89b6b7d3
...
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -120,4 +121,20 @@ public class ReviewStandardController extends BaseController {
...
@@ -120,4 +121,20 @@ public class ReviewStandardController extends BaseController {
public
TableDataInfo
<
ReviewStandard
>
findDetailsList
(
@Validated
@RequestBody
ReviewFindListRequest
request
)
{
public
TableDataInfo
<
ReviewStandard
>
findDetailsList
(
@Validated
@RequestBody
ReviewFindListRequest
request
)
{
return
getDataTable
(
reviewStandardService
.
findDetailsList
(
request
));
return
getDataTable
(
reviewStandardService
.
findDetailsList
(
request
));
}
}
/**
* 检验内容库科恩获取车型试验
* @param request
* @return
* @throws IOException
*/
@ApiOperation
(
"检验内容库查询车型试验(科恩)"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getList"
,
produces
=
"application/json;charset=UTF-8"
)
public
R
<
InspectionContentResponse
>
getList
(
@Validated
@RequestBody
String
request
)
throws
IOException
{
return
R
.
ok
(
reviewStandardService
.
getList
(
request
));
}
}
}
quality-review/src/main/java/com/ruoyi/web/TestUserCaseController.java
View file @
89b6b7d3
...
@@ -6,7 +6,9 @@ import com.ruoyi.domain.TestUseCase;
...
@@ -6,7 +6,9 @@ import com.ruoyi.domain.TestUseCase;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
...
@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.List
;
@Api
(
tags
=
"测试用例"
)
@Api
(
tags
=
"测试用例"
)
...
@@ -57,4 +60,21 @@ public class TestUserCaseController extends BaseController{
...
@@ -57,4 +60,21 @@ public class TestUserCaseController extends BaseController{
public
R
<
List
<
String
>>
getCaseByScenario
(
@Validated
@RequestBody
TestUseCaseByScenarioRequest
request
)
{
public
R
<
List
<
String
>>
getCaseByScenario
(
@Validated
@RequestBody
TestUseCaseByScenarioRequest
request
)
{
return
R
.
ok
(
testUseCaseService
.
selectCaseByScenario
(
request
));
return
R
.
ok
(
testUseCaseService
.
selectCaseByScenario
(
request
));
}
}
/**
* 科恩获取测试用例
* @param request
* @return
* @throws IOException
*/
@ApiOperation
(
"查询测试用例分页查询(科恩)"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/getUseCaseList"
,
produces
=
"application/json;charset=UTF-8"
)
public
R
<
TestUserCaseListResponse
>
getUseCaseList
(
@Validated
@RequestBody
String
request
)
throws
IOException
{
return
R
.
ok
(
testUseCaseService
.
getUseCaseList
(
request
));
}
}
}
quality-review/src/main/java/com/ruoyi/web/response/InspectionContentResponse.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
.
web
.
response
;
import
com.ruoyi.domain.vo.InspectionContentVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@ApiModel
(
value
=
"InspectionContentResponse"
,
description
=
"查询检验内容库车型试验"
)
@Data
public
class
InspectionContentResponse
{
@ApiModelProperty
(
"测试用例"
)
List
<
InspectionContentVO
>
inspectionContent
;
@ApiModelProperty
(
"总条数"
)
Integer
totalCount
;
}
quality-review/src/main/java/com/ruoyi/web/response/TestUserCaseListResponse.java
View file @
89b6b7d3
package
com
.
ruoyi
.
web
.
response
;
package
com
.
ruoyi
.
web
.
response
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
@ApiModel
(
value
=
"TestUserCaseListResponse"
,
description
=
"查询测试用例"
)
@ApiModel
(
value
=
"TestUserCaseListResponse"
,
description
=
"查询测试用例"
)
@Data
@Data
public
class
TestUserCaseListResponse
{
public
class
TestUserCaseListResponse
{
@ApiModelProperty
(
"测试场景"
)
@ApiModelProperty
(
"测试用例"
)
private
String
testScenario
;
List
<
UseCaseUrlVO
>
useCases
;
@ApiModelProperty
(
"测试方法"
)
private
String
testType
;
@ApiModelProperty
(
"用例编号"
)
private
String
useCaseNo
;
@ApiModelProperty
(
"用例名称"
)
private
String
useCaseName
;
@ApiModelProperty
(
"
对应输入
"
)
@ApiModelProperty
(
"
总条数
"
)
private
String
inpu
t
;
Integer
totalCoun
t
;
@ApiModelProperty
(
"用例描述"
)
private
String
description
;
}
}
ruoyi-admin/src/test/java/com/ruoyi/TestUrl.java
0 → 100644
View file @
89b6b7d3
package
com
.
ruoyi
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
okhttp3.*
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
java.io.IOException
;
import
java.util.List
;
@SpringBootTest
public
class
TestUrl
{
@Test
public
void
test
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
// 定义查询变量
String
variables
=
"{ \"offset\": { \"offset\": 0, \"limit\": 10 }, \"orderBy\": { \"field\": \"displayID\", \"order\": \"DESC\" }, \"search\": \"Z\"}"
;
// 创建请求体
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
"{\"query\":\"query useCases($offset:OffsetConnectionInput$orderBy:OrderByInput$filter:Map$search:String){useCases(offset:$offset orderBy:$orderBy filterFields:$filter search:$search){nodes{id displayID class name description remediation requirements riskLevel}totalCount}}\",\"variables\":"
+
variables
+
"}"
);
Request
request
=
new
Request
.
Builder
()
.
url
(
"http://10.12.48.80:8089/api/query"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
// .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
(
request
).
execute
();
String
string
=
response
.
body
().
string
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
List
<
UseCaseUrlVO
>
list
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"useCases"
).
getList
(
"nodes"
,
UseCaseUrlVO
.
class
);
list
.
forEach
(
item
->
{
System
.
out
.
println
(
"item = "
+
item
);
});
}
}
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