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
a103cfe1
Commit
a103cfe1
authored
Feb 18, 2024
by
王飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、实现用例矩阵查询
parent
b35c1f29
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
13 deletions
+89
-13
MatrixColumnVO.java
...iew/src/main/java/com/ruoyi/domain/vo/MatrixColumnVO.java
+6
-0
MatrixRowVO.java
...review/src/main/java/com/ruoyi/domain/vo/MatrixRowVO.java
+4
-5
MatrixServiceImpl.java
...c/main/java/com/ruoyi/service/impl/MatrixServiceImpl.java
+68
-1
MatrixResponse.java
.../src/main/java/com/ruoyi/web/response/MatrixResponse.java
+2
-1
MatrixTest.java
ruoyi-admin/src/test/java/com/ruoyi/MatrixTest.java
+8
-5
WebSocketConfig.java
...n/java/com/ruoyi/framework/websocket/WebSocketConfig.java
+1
-1
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/MatrixColumnVO.java
View file @
a103cfe1
...
@@ -2,12 +2,18 @@ package com.ruoyi.domain.vo;
...
@@ -2,12 +2,18 @@ package com.ruoyi.domain.vo;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"MatrixColumnVO"
,
description
=
"用例矩阵-列"
)
@ApiModel
(
value
=
"MatrixColumnVO"
,
description
=
"用例矩阵-列"
)
@Data
@Data
public
class
MatrixColumnVO
{
public
class
MatrixColumnVO
{
private
Long
id
;
@ApiModelProperty
(
"列名称"
)
@ApiModelProperty
(
"列名称"
)
private
String
title
;
private
String
title
;
...
...
quality-review/src/main/java/com/ruoyi/domain/vo/MatrixRowVO.java
View file @
a103cfe1
...
@@ -2,10 +2,12 @@ package com.ruoyi.domain.vo;
...
@@ -2,10 +2,12 @@ package com.ruoyi.domain.vo;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@NoArgsConstructor
@AllArgsConstructor
@ApiModel
(
value
=
"MatrixRowVO"
,
description
=
"用例矩阵-行"
)
@ApiModel
(
value
=
"MatrixRowVO"
,
description
=
"用例矩阵-行"
)
@Data
@Data
public
class
MatrixRowVO
{
public
class
MatrixRowVO
{
...
@@ -13,7 +15,4 @@ public class MatrixRowVO {
...
@@ -13,7 +15,4 @@ public class MatrixRowVO {
@ApiModelProperty
(
"行名称"
)
@ApiModelProperty
(
"行名称"
)
private
String
name
;
private
String
name
;
@ApiModelProperty
(
"当前行包含的所有列"
)
private
List
<
MatrixColumnVO
>
columns
;
}
}
quality-review/src/main/java/com/ruoyi/service/impl/MatrixServiceImpl.java
View file @
a103cfe1
package
com
.
ruoyi
.
service
.
impl
;
package
com
.
ruoyi
.
service
.
impl
;
import
com.ruoyi.domain.TestScenario
;
import
com.ruoyi.domain.TestType
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.vo.MatrixColumnVO
;
import
com.ruoyi.domain.vo.MatrixRowVO
;
import
com.ruoyi.service.ITestScenarioService
;
import
com.ruoyi.service.ITestTypeService
;
import
com.ruoyi.service.MatrixService
;
import
com.ruoyi.service.MatrixService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.response.MatrixResponse
;
import
com.ruoyi.web.response.MatrixResponse
;
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
java.time.format.TextStyle
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Transactional
@Service
@Service
public
class
MatrixServiceImpl
implements
MatrixService
{
public
class
MatrixServiceImpl
implements
MatrixService
{
@Autowired
@Autowired
private
TestUseCaseService
testUseCaseService
;
private
TestUseCaseService
testUseCaseService
;
@Autowired
private
ITestScenarioService
testScenarioService
;
@Autowired
private
ITestTypeService
testTypeService
;
@Override
@Override
public
MatrixResponse
getMatrix
()
{
public
MatrixResponse
getMatrix
()
{
List
<
TestUseCase
>
useCases
=
testUseCaseService
.
list
();
List
<
TestUseCase
>
useCases
=
testUseCaseService
.
list
();
List
<
TestScenario
>
scenarios
=
testScenarioService
.
list
();
List
<
TestType
>
types
=
testTypeService
.
list
();
MatrixResponse
response
=
new
MatrixResponse
();
setHeader
(
response
,
types
);
setRows
(
response
,
scenarios
,
types
,
useCases
);
return
response
;
}
private
void
setHeader
(
MatrixResponse
response
,
List
<
TestType
>
types
)
{
List
<
MatrixColumnVO
>
columns
=
new
ArrayList
();
for
(
TestType
type
:
types
)
{
MatrixColumnVO
column
=
new
MatrixColumnVO
(
type
.
getId
(),
type
.
getTestType
(),
null
);
columns
.
add
(
column
);
}
response
.
setHeader
(
columns
);
return
null
;
}
}
private
void
setRows
(
MatrixResponse
response
,
List
<
TestScenario
>
scenarios
,
List
<
TestType
>
types
,
List
<
TestUseCase
>
useCases
)
{
List
<
Map
<
String
,
Object
>>
rows
=
new
ArrayList
();
for
(
TestScenario
scenario
:
scenarios
)
{
Map
<
String
,
Object
>
row
=
new
HashMap
();
row
.
put
(
"name"
,
scenario
.
getTestScenario
());
for
(
TestType
type
:
types
)
{
String
columnId
=
String
.
valueOf
(
type
.
getId
());
String
coordinates
=
scenario
.
getId
()
+
columnId
;
Long
useCaseId
=
getUseCaseIdByCoordinates
(
useCases
,
coordinates
);
row
.
put
(
columnId
,
useCaseId
==
null
?
""
:
String
.
valueOf
(
useCaseId
));
}
rows
.
add
(
row
);
}
response
.
setRows
(
rows
);
}
public
Long
getUseCaseIdByCoordinates
(
List
<
TestUseCase
>
useCases
,
String
coordinates
)
{
for
(
TestUseCase
useCase
:
useCases
)
{
if
(
useCase
.
getCoordinates
().
equals
(
coordinates
))
{
return
useCase
.
getId
();
}
}
return
null
;
}
}
}
quality-review/src/main/java/com/ruoyi/web/response/MatrixResponse.java
View file @
a103cfe1
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModel;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@ApiModel
(
value
=
"MatrixResponse"
,
description
=
"用例矩阵"
)
@ApiModel
(
value
=
"MatrixResponse"
,
description
=
"用例矩阵"
)
@Data
@Data
...
@@ -13,6 +14,6 @@ public class MatrixResponse {
...
@@ -13,6 +14,6 @@ public class MatrixResponse {
private
List
<
MatrixColumnVO
>
header
;
private
List
<
MatrixColumnVO
>
header
;
private
List
<
Ma
trixRowVO
>
rows
;
private
List
<
Ma
p
<
String
,
Object
>
>
rows
;
}
}
ruoyi-admin/src/test/java/com/ruoyi/MatrixTest.java
View file @
a103cfe1
package
com
.
ruoyi
;
package
com
.
ruoyi
;
import
cn.hutool.json.JSONUtil
;
import
com.ruoyi.service.MatrixService
;
import
com.ruoyi.web.response.MatrixResponse
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
...
@@ -8,13 +12,12 @@ import java.util.ArrayList;
...
@@ -8,13 +12,12 @@ import java.util.ArrayList;
@SpringBootTest
@SpringBootTest
public
class
MatrixTest
{
public
class
MatrixTest
{
@Autowired
private
MatrixService
matrixService
;
@Test
@Test
public
void
generateMatrixTest
()
{
public
void
generateMatrixTest
()
{
MatrixResponse
matrix
=
matrixService
.
getMatrix
();
System
.
out
.
println
(
JSONUtil
.
toJsonPrettyStr
(
matrix
));
}
}
}
}
ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketConfig.java
View file @
a103cfe1
...
@@ -9,7 +9,7 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
...
@@ -9,7 +9,7 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
*
*
* @author ruoyi
* @author ruoyi
*/
*/
@Configuration
//
@Configuration
public
class
WebSocketConfig
public
class
WebSocketConfig
{
{
@Bean
@Bean
...
...
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