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
2c8d0e90
Commit
2c8d0e90
authored
Apr 30, 2024
by
wdy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into 'master'
dev - master 8 See merge request
!310
parents
3d1602ff
b491d203
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
483 additions
and
19 deletions
+483
-19
CaseStatisticsVO.java
...w/src/main/java/com/ruoyi/domain/vo/CaseStatisticsVO.java
+16
-0
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
+16
-0
TestUseCaseService.java
...w/src/main/java/com/ruoyi/service/TestUseCaseService.java
+11
-0
ReviewStandardServiceImpl.java
...ava/com/ruoyi/service/impl/ReviewStandardServiceImpl.java
+61
-0
TaskServiceImpl.java
...src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
+14
-1
TestRecordsServiceImpl.java
...n/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
+2
-2
TestUseCaseServiceImpl.java
...n/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
+46
-0
ReviewStandardController.java
...src/main/java/com/ruoyi/web/ReviewStandardController.java
+33
-0
TestUserCaseController.java
...w/src/main/java/com/ruoyi/web/TestUserCaseController.java
+20
-0
ReviewStandardListByPageRequest.java
...om/ruoyi/web/request/ReviewStandardListByPageRequest.java
+0
-1
InspectionContentResponse.java
...ava/com/ruoyi/web/response/InspectionContentResponse.java
+19
-0
TestUserCaseListResponse.java
...java/com/ruoyi/web/response/TestUserCaseListResponse.java
+7
-15
UseCaseListResponse.java
...main/java/com/ruoyi/web/response/UseCaseListResponse.java
+22
-0
TestUrl.java
ruoyi-admin/src/test/java/com/ruoyi/TestUrl.java
+48
-0
pom.xml
ruoyi-system/pom.xml
+4
-0
UserCountVo.java
...src/main/java/com/ruoyi/system/domain/vo/UserCountVo.java
+22
-0
SysUserMapper.java
.../src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
+8
-0
SysUserServiceImpl.java
...ava/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+12
-0
SysUserMapper.xml
...system/src/main/resources/mapper/system/SysUserMapper.xml
+11
-0
No files found.
quality-review/src/main/java/com/ruoyi/domain/vo/CaseStatisticsVO.java
0 → 100644
View file @
2c8d0e90
package
com
.
ruoyi
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"CaseStatisticsVO"
,
description
=
"项目用例统计列表VO"
)
@Data
public
class
CaseStatisticsVO
{
@ApiModelProperty
(
"用例检测状态枚举"
)
private
String
status
;
@ApiModelProperty
(
"用例数量"
)
private
Integer
count
;
}
quality-review/src/main/java/com/ruoyi/domain/vo/InspectionContentVO.java
0 → 100644
View file @
2c8d0e90
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 @
2c8d0e90
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 @
2c8d0e90
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 @
2c8d0e90
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 @
2c8d0e90
...
...
@@ -8,6 +8,7 @@ import com.ruoyi.web.request.ReviewStandardListRequest;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.response.*
;
import
java.io.IOException
;
import
java.util.List
;
public
interface
ReviewStandardService
extends
IService
<
ReviewStandard
>
{
...
...
@@ -70,4 +71,19 @@ public interface ReviewStandardService extends IService<ReviewStandard> {
* @param request
*/
void
saveStandardUsecase
(
ReviewStandardSaveStandardUsecaseRequest
request
);
/**
* 检验内容库科恩获取车型试验
* @param request
* @return
* @throws IOException
*/
InspectionContentResponse
getList
(
String
request
)
throws
IOException
;
/**
* 检验内容库查询标准下测试用例(科恩)
* @param request
* @return
*/
List
<
UseCaseListResponse
>
getUseCaseList
(
String
request
)
throws
IOException
;
}
quality-review/src/main/java/com/ruoyi/service/TestUseCaseService.java
View file @
2c8d0e90
...
...
@@ -5,8 +5,11 @@ import com.ruoyi.domain.TestUseCase;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -45,4 +48,12 @@ public interface TestUseCaseService extends IService<TestUseCase> {
* @return
*/
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 @
2c8d0e90
package
com
.
ruoyi
.
service
.
impl
;
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.update.UpdateWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.domain.vo.InspectionContentVO
;
import
com.ruoyi.domain.vo.OptionalUseCasesVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.web.request.ReviewFindListRequest
;
...
...
@@ -14,10 +17,12 @@ import com.ruoyi.web.request.ReviewStandardListByPageRequest;
import
com.ruoyi.web.request.ReviewStandardListRequest
;
import
com.ruoyi.web.request.ReviewStandardSaveStandardUsecaseRequest
;
import
com.ruoyi.web.response.*
;
import
okhttp3.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -184,6 +189,62 @@ 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$searchFields:Map){regulationByName(name:$name){items(offset:$offset orderBy:$orderBy searchFields:$searchFields){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
);
if
(
jsonObject
.
getJSONObject
(
"data"
).
getJSONObject
(
"regulationByName"
)
!=
null
)
{
// 获取测试用例
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
);
}
else
{
List
<
InspectionContentVO
>
list
=
new
ArrayList
<>();
inspectionContentResponse
.
setInspectionContent
(
list
);
inspectionContentResponse
.
setTotalCount
(
0
);
}
return
inspectionContentResponse
;
}
@Override
public
List
<
UseCaseListResponse
>
getUseCaseList
(
String
request
)
throws
IOException
{
// TODO 检验内容库查询标准下测试用例(科恩)
return
null
;
}
/**
* 将审查 标准、要点、细则、场景 按照父子关系拆分写入到各自的表中
* @param reviewStandardList
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TaskServiceImpl.java
View file @
2c8d0e90
...
...
@@ -15,6 +15,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.bean.BeanUtils
;
import
com.ruoyi.domain.*
;
import
com.ruoyi.domain.vo.CaseStatisticsVO
;
import
com.ruoyi.mapper.*
;
import
com.ruoyi.service.*
;
import
com.ruoyi.system.service.ISysUserService
;
...
...
@@ -864,6 +865,18 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
// 获取项目id
Integer
useCaseNum
=
(
Integer
)
jsonObject
.
get
(
"case_count"
);
// 获取已忽略用例数
List
<
CaseStatisticsVO
>
statisticsVOList
=
jsonObject
.
getList
(
"case_statistics"
,
CaseStatisticsVO
.
class
);
Integer
ignoredNum
=
0
;
for
(
CaseStatisticsVO
vo
:
statisticsVOList
)
{
if
(
Objects
.
equals
(
vo
.
getStatus
(),
"IGNORED"
))
{
ignoredNum
=
vo
.
getCount
();
break
;
}
}
// 任务是否有选择用例
response
.
setTaskScenario
(
useCaseNum
>
0
);
...
...
@@ -877,7 +890,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>implements Tas
}
else
if
(
resultNum
==
null
)
{
response
.
setTest
(
0.0
);
}
else
{
BigDecimal
num
=
new
BigDecimal
((
1.0
*
resultNum
/
useCaseNum
)
*
90
);
BigDecimal
num
=
new
BigDecimal
((
1.0
*
resultNum
/
(
useCaseNum
-
ignoredNum
)
)
*
90
);
response
.
setTest
(
num
.
setScale
(
1
,
BigDecimal
.
ROUND_UP
).
doubleValue
());
}
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TestRecordsServiceImpl.java
View file @
2c8d0e90
...
...
@@ -204,10 +204,10 @@ public class TestRecordsServiceImpl extends ServiceImpl<TestRecordsMapper, TestR
if
(
testDetails
!=
null
)
{
testDetails
=
convertMarkdownToHtml
(
testDetails
);
}
testDetailsVO
+=
testDetails
+
"
`
"
;
testDetailsVO
+=
testDetails
+
"
<br>
"
;
}
testDetailsVO
=
testDetailsVO
.
substring
(
0
,
testDetailsVO
.
length
()
-
1
);
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"
`
"
));
testRecords
.
setTestMethod
(
StringUtils
.
join
(
stepList
,
"
\n
"
));
testRecords
.
setTestDetails
(
testDetailsVO
);
}
...
...
quality-review/src/main/java/com/ruoyi/service/impl/TestUseCaseServiceImpl.java
View file @
2c8d0e90
...
...
@@ -6,15 +6,19 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import
com.ruoyi.domain.TestUseCase
;
import
com.ruoyi.domain.vo.CaseResultVO
;
import
com.ruoyi.domain.vo.TestUsecaseVO
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.mapper.TestUseCaseMapper
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
okhttp3.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -88,6 +92,48 @@ public class TestUseCaseServiceImpl extends ServiceImpl<TestUseCaseMapper, TestU
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 @
2c8d0e90
...
...
@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -120,4 +121,36 @@ public class ReviewStandardController extends BaseController {
public
TableDataInfo
<
ReviewStandard
>
findDetailsList
(
@Validated
@RequestBody
ReviewFindListRequest
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
));
}
/**
* 检验内容库查询标准下测试用例(科恩)
* @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
TableDataInfo
<
UseCaseListResponse
>
getUseCaseList
(
@Validated
@RequestBody
String
request
)
throws
IOException
{
return
getDataTable
(
reviewStandardService
.
getUseCaseList
(
request
));
}
}
quality-review/src/main/java/com/ruoyi/web/TestUserCaseController.java
View file @
2c8d0e90
...
...
@@ -6,7 +6,9 @@ import com.ruoyi.domain.TestUseCase;
import
com.ruoyi.service.TestUseCaseService
;
import
com.ruoyi.web.request.TestUseCaseByScenarioRequest
;
import
com.ruoyi.web.request.TestUseCaseIdListRequest
;
import
com.ruoyi.web.request.TestUserCaseListRequest
;
import
com.ruoyi.web.request.TestUserCaseRequest
;
import
com.ruoyi.web.response.TestUserCaseListResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.skywalking.apm.toolkit.trace.Tag
;
...
...
@@ -16,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.io.IOException
;
import
java.util.List
;
@Api
(
tags
=
"测试用例"
)
...
...
@@ -57,4 +60,21 @@ public class TestUserCaseController extends BaseController{
public
R
<
List
<
String
>>
getCaseByScenario
(
@Validated
@RequestBody
TestUseCaseByScenarioRequest
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/request/ReviewStandardListByPageRequest.java
View file @
2c8d0e90
...
...
@@ -20,7 +20,6 @@ public class ReviewStandardListByPageRequest extends PageDomain {
* 大标准ID
*/
@ApiModelProperty
(
"总标准ID"
)
@NotNull
(
message
=
"总标准ID不能为空"
)
private
Long
standardId
;
/**
...
...
quality-review/src/main/java/com/ruoyi/web/response/InspectionContentResponse.java
0 → 100644
View file @
2c8d0e90
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 @
2c8d0e90
package
com
.
ruoyi
.
web
.
response
;
import
com.ruoyi.domain.vo.UseCaseUrlVO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
@ApiModel
(
value
=
"TestUserCaseListResponse"
,
description
=
"查询测试用例"
)
@Data
public
class
TestUserCaseListResponse
{
@ApiModelProperty
(
"测试场景"
)
private
String
testScenario
;
@ApiModelProperty
(
"测试方法"
)
private
String
testType
;
@ApiModelProperty
(
"用例编号"
)
private
String
useCaseNo
;
@ApiModelProperty
(
"用例名称"
)
private
String
useCaseName
;
@ApiModelProperty
(
"测试用例"
)
List
<
UseCaseUrlVO
>
useCases
;
@ApiModelProperty
(
"
对应输入
"
)
private
String
inpu
t
;
@ApiModelProperty
(
"
总条数
"
)
Integer
totalCoun
t
;
@ApiModelProperty
(
"用例描述"
)
private
String
description
;
}
quality-review/src/main/java/com/ruoyi/web/response/UseCaseListResponse.java
0 → 100644
View file @
2c8d0e90
package
com
.
ruoyi
.
web
.
response
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@ApiModel
(
value
=
"UseCaseListResponse"
,
description
=
"查询标准下测试用例"
)
@Data
public
class
UseCaseListResponse
{
@ApiModelProperty
(
"测试场景"
)
private
String
testScenario
;
@ApiModelProperty
(
"测试方法"
)
private
String
testMethod
;
@ApiModelProperty
(
"用例编号"
)
private
String
displayID
;
@ApiModelProperty
(
"用例名称"
)
private
String
name
;
}
ruoyi-admin/src/test/java/com/ruoyi/TestUrl.java
0 → 100644
View file @
2c8d0e90
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
);
});
}
}
ruoyi-system/pom.xml
View file @
2c8d0e90
...
...
@@ -22,6 +22,10 @@
<groupId>
com.ruoyi
</groupId>
<artifactId>
ruoyi-common
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
</dependencies>
...
...
ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/UserCountVo.java
0 → 100644
View file @
2c8d0e90
package
com
.
ruoyi
.
system
.
domain
.
vo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Builder
;
import
lombok.Data
;
@Data
@Builder
@ApiModel
(
"检验员VO"
)
public
class
UserCountVo
{
@ApiModelProperty
(
"检验员id"
)
private
Long
userId
;
@ApiModelProperty
(
"用户所进行任务数量"
)
private
Long
countNum
;
@ApiModelProperty
(
"用户名"
)
private
String
nikeName
;
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
View file @
2c8d0e90
package
com
.
ruoyi
.
system
.
mapper
;
import
java.util.List
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
org.apache.ibatis.annotations.Param
;
import
com.ruoyi.common.core.domain.entity.SysUser
;
...
...
@@ -138,4 +139,11 @@ public interface SysUserMapper
* @return
*/
List
<
SysUser
>
selectUserListByRoleId
(
@Param
(
"roleId"
)
Long
roleId
);
/**
* 查询用户所含进行中任务数
* @param userIds
* @return
*/
List
<
UserCountVo
>
countTaskByUserId
(
@Param
(
"userIds"
)
Long
[]
userIds
);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
View file @
2c8d0e90
...
...
@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import
javax.validation.Validator
;
import
com.ruoyi.common.core.domain.entity.SysDept
;
import
com.ruoyi.system.domain.vo.UserCountVo
;
import
com.ruoyi.system.mapper.*
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -475,6 +476,17 @@ public class SysUserServiceImpl implements ISysUserService
checkUserAllowed
(
new
SysUser
(
userId
));
checkUserDataScope
(
userId
);
}
List
<
UserCountVo
>
list
=
userMapper
.
countTaskByUserId
(
userIds
);
StringBuilder
msg
=
new
StringBuilder
();
for
(
UserCountVo
countVo
:
list
)
{
if
(
countVo
.
getCountNum
()
>
0
)
{
msg
.
append
(
countVo
.
getNikeName
()).
append
(
"、"
);
}
}
if
(
StringUtils
.
isNotEmpty
(
msg
.
toString
()))
{
msg
=
new
StringBuilder
(
msg
.
substring
(
0
,
msg
.
length
()
-
1
));
throw
new
ServiceException
(
"用户:"
+
msg
+
"存在进行中的任务,不能删除"
);
}
// 删除用户与角色关联
userRoleMapper
.
deleteUserRole
(
userIds
);
// 删除用户与岗位关联
...
...
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
View file @
2c8d0e90
...
...
@@ -229,5 +229,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{userId}
</foreach>
</delete>
<select
id=
"countTaskByUserId"
resultType=
"com.ruoyi.system.domain.vo.UserCountVo"
>
select count(*) countNum, tr.user_id userId, s.nick_name nikeName
from t_task t
left join t_task_user_relation tr on tr.task_id = t.id
left join sys_user s on s.user_id = tr.user_id
where t.task_status in ('NEW','PENDING') and tr.user_id in
<foreach
item=
"item"
collection=
"userIds"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
group by tr.user_id
</select>
</mapper>
\ No newline at end of file
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