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
2f8742a7
Commit
2f8742a7
authored
Sep 02, 2024
by
高滢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车型实验测试用例
parent
f54d9f5f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
4 deletions
+86
-4
ItemsByUseCaseVO.java
...w/src/main/java/com/ruoyi/domain/vo/ItemsByUseCaseVO.java
+16
-0
RecaordUseCasesVO.java
.../src/main/java/com/ruoyi/domain/vo/RecaordUseCasesVO.java
+24
-0
TTestPlanRecordService.java
...c/main/java/com/ruoyi/service/TTestPlanRecordService.java
+3
-0
TTestPlanRecordServiceImpl.java
...va/com/ruoyi/service/impl/TTestPlanRecordServiceImpl.java
+29
-0
TestPlanRecordController.java
...src/main/java/com/ruoyi/web/TestPlanRecordController.java
+14
-4
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/ItemsByUseCaseVO.java
0 → 100644
View file @
2f8742a7
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
java.util.List
;
@ApiModel
(
description
=
"车型实验用例VO"
)
@Data
public
class
ItemsByUseCaseVO
{
private
String
id
;
private
String
serialNumber
;
private
String
requirements
;
private
List
<
RecaordUseCasesVO
>
useCases
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/RecaordUseCasesVO.java
0 → 100644
View file @
2f8742a7
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
@ApiModel
(
description
=
"车型实验用例VO"
)
@Data
public
class
RecaordUseCasesVO
{
private
String
id
;
private
String
displayID
;
private
String
customizedID
;
private
String
name
;
private
String
description
;
private
String
remediation
;
private
String
requirements
;
private
String
riskLevel
;
private
String
method
;
private
String
scenario
;
}
quality-review/src/main/java/com/ruoyi/service/TTestPlanRecordService.java
View file @
2f8742a7
...
...
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.ruoyi.web.request.TestPlanRecordGetInfoRequest
;
import
com.ruoyi.web.request.TestPlanRecordPageRequest
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -22,4 +23,6 @@ public interface TTestPlanRecordService extends IService<TTestPlanRecord> {
public
int
updateTestPlanRecord
(
TestPlanRecordGetInfoRequest
testPlanRecordGetInfoRequest
);
public
List
getCarTestDetail
(
String
request
)
throws
IOException
;
}
quality-review/src/main/java/com/ruoyi/service/impl/TTestPlanRecordServiceImpl.java
View file @
2f8742a7
package
com
.
ruoyi
.
service
.
impl
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.utils.SecurityUtils
;
import
com.ruoyi.domain.TTestPlanRecord
;
import
com.ruoyi.domain.vo.ItemsByUseCaseVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.service.TTestPlanRecordService
;
import
com.ruoyi.mapper.TTestPlanRecordMapper
;
import
com.ruoyi.web.request.TestPlanRecordGetInfoRequest
;
import
com.ruoyi.web.request.TestPlanRecordPageRequest
;
import
okhttp3.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -46,6 +52,29 @@ public class TTestPlanRecordServiceImpl extends ServiceImpl<TTestPlanRecordMappe
public
int
updateTestPlanRecord
(
TestPlanRecordGetInfoRequest
testPlanRecordGetInfoRequest
){
return
tTestPlanRecordMapper
.
updateTestPlanRecord
(
testPlanRecordGetInfoRequest
);
}
@Override
public
List
getCarTestDetail
(
String
request
)
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
"{\"query\":\"query regulationItemsByUseCase($regulationName:String!$matchUseCases:[String!]!){regulationByName(name:$regulationName){itemsByUseCase(match:$matchUseCases){id serialNumber requirements useCases{id displayID customizedID class name description remediation requirements riskLevel method{name}scenario{name}}}}}\",\"variables\":"
+
request
+
"}"
);
Request
requestKs
=
new
Request
.
Builder
()
.
url
(
"http://10.12.48.80:8089/api/query"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
addHeader
(
"Authorization"
,
"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjAsInRva2VuaWQiOjYxLCJ0eXBlIjoiYXBpIiwidXNlcm5hbWUiOiJhZG1pbiJ9.48Ggjx-FtOcecf73vAHn0XglwgLXZlfXxhXiLDHWWQE"
)
.
build
();
Response
response
=
client
.
newCall
(
requestKs
).
execute
();
String
string
=
response
.
body
().
string
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
string
);
// List listUseCase = new ArrayList();
List
listUseCase
=
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
).
getList
(
"itemsByUseCase"
,
ItemsByUseCaseVO
.
class
);
return
listUseCase
;
}
}
...
...
quality-review/src/main/java/com/ruoyi/web/TestPlanRecordController.java
View file @
2f8742a7
package
com
.
ruoyi
.
web
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.common.annotation.Log
;
import
com.ruoyi.common.core.domain.R
;
import
com.ruoyi.common.core.page.TableDataInfo
;
...
...
@@ -14,17 +15,17 @@ import com.ruoyi.web.request.TestPlanRecordGetInfoRequest;
import
com.ruoyi.web.request.TestPlanRecordPageRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.v3.oas.annotations.parameters.RequestBody
;
import
okhttp3.*
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
import
org.apache.skywalking.apm.toolkit.trace.Tags
;
import
org.apache.skywalking.apm.toolkit.trace.Trace
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.ruoyi.common.core.controller.BaseController
;
import
java.io.IOException
;
import
java.util.List
;
...
...
@@ -83,4 +84,13 @@ public class TestPlanRecordController extends BaseController{
public
R
<
Integer
>
updateTestPlanRecord
(
TestPlanRecordGetInfoRequest
testPlanRecordGetInfoRequest
){
return
R
.
ok
(
tTestPlanRecordService
.
updateTestPlanRecord
(
testPlanRecordGetInfoRequest
));
}
@ApiOperation
(
"车型实验详情"
)
@Trace
@Tags
({
@Tag
(
key
=
"param"
,
value
=
"arg[0]"
),
@Tag
(
key
=
"result"
,
value
=
"returnedObj"
)})
@RequestMapping
(
method
=
RequestMethod
.
POST
,
value
=
"/useCase"
)
public
R
<
List
>
getUseCases
(
@Validated
@RequestBody
String
request
)
throws
IOException
{
return
R
.
ok
(
tTestPlanRecordService
.
getCarTestDetail
(
request
));
}
}
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