feat(用例管理): 评审标准为多人评审的用例评审,用例评审详新增我的评审状态筛选条件前后端接口代码
This commit is contained in:
parent
cb3d2ed2ea
commit
cd1e8d3ca4
|
@ -58,4 +58,7 @@ public class ReviewFunctionalCaseDTO implements Serializable {
|
||||||
@Schema(description = "用例创建人名称")
|
@Schema(description = "用例创建人名称")
|
||||||
private String createUserName;
|
private String createUserName;
|
||||||
|
|
||||||
|
@Schema(description = "只看我的评审状态")
|
||||||
|
private String myStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.metersphere.functional.mapper;
|
package io.metersphere.functional.mapper;
|
||||||
|
|
||||||
|
import io.metersphere.functional.domain.CaseReviewHistory;
|
||||||
import io.metersphere.functional.dto.CaseReviewHistoryDTO;
|
import io.metersphere.functional.dto.CaseReviewHistoryDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
@ -19,4 +20,6 @@ public interface ExtCaseReviewHistoryMapper {
|
||||||
void updateAbandoned(@Param("caseId") String caseId);
|
void updateAbandoned(@Param("caseId") String caseId);
|
||||||
|
|
||||||
void batchUpdateAbandoned(@Param("reviewId") String reviewId, @Param("caseIds") List<String> caseIds);
|
void batchUpdateAbandoned(@Param("reviewId") String reviewId, @Param("caseIds") List<String> caseIds);
|
||||||
|
|
||||||
|
List<CaseReviewHistory> getReviewHistoryStatus(@Param("caseIds") List<String> caseIds, @Param("reviewId") String reviewId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,4 +79,23 @@
|
||||||
and abandoned = false
|
and abandoned = false
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getReviewHistoryStatus" resultType="io.metersphere.functional.domain.CaseReviewHistory">
|
||||||
|
SELECT
|
||||||
|
review_id,
|
||||||
|
case_id,
|
||||||
|
STATUS,
|
||||||
|
create_user
|
||||||
|
FROM
|
||||||
|
case_review_history
|
||||||
|
WHERE
|
||||||
|
review_id = #{reviewId}
|
||||||
|
AND case_id IN
|
||||||
|
<foreach collection="caseIds" item="caseId" separator="," open="(" close=")">
|
||||||
|
#{caseId}
|
||||||
|
</foreach>
|
||||||
|
AND abandoned = FALSE
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -30,4 +30,7 @@ public class ReviewFunctionalCasePageRequest extends BasePageRequest implements
|
||||||
|
|
||||||
@Schema(description = "模块id")
|
@Schema(description = "模块id")
|
||||||
private List<String> moduleIds;
|
private List<String> moduleIds;
|
||||||
|
|
||||||
|
@Schema(description = "我的评审结果", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
private boolean viewStatusFlag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,10 +123,10 @@ public class CaseReviewFunctionalCaseService {
|
||||||
*/
|
*/
|
||||||
public List<ReviewFunctionalCaseDTO> page(ReviewFunctionalCasePageRequest request, boolean deleted, String userId) {
|
public List<ReviewFunctionalCaseDTO> page(ReviewFunctionalCasePageRequest request, boolean deleted, String userId) {
|
||||||
List<ReviewFunctionalCaseDTO> list = extCaseReviewFunctionalCaseMapper.page(request, deleted, userId, request.getSortString());
|
List<ReviewFunctionalCaseDTO> list = extCaseReviewFunctionalCaseMapper.page(request, deleted, userId, request.getSortString());
|
||||||
return doHandleDTO(list, request.getReviewId());
|
return doHandleDTO(list, request, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ReviewFunctionalCaseDTO> doHandleDTO(List<ReviewFunctionalCaseDTO> list, String reviewId) {
|
private List<ReviewFunctionalCaseDTO> doHandleDTO(List<ReviewFunctionalCaseDTO> list, ReviewFunctionalCasePageRequest request, String userId) {
|
||||||
if (CollectionUtils.isNotEmpty(list)) {
|
if (CollectionUtils.isNotEmpty(list)) {
|
||||||
List<String> moduleIds = list.stream().map(ReviewFunctionalCaseDTO::getModuleId).toList();
|
List<String> moduleIds = list.stream().map(ReviewFunctionalCaseDTO::getModuleId).toList();
|
||||||
List<BaseTreeNode> modules = extFunctionalCaseModuleMapper.selectBaseByIds(moduleIds);
|
List<BaseTreeNode> modules = extFunctionalCaseModuleMapper.selectBaseByIds(moduleIds);
|
||||||
|
@ -137,20 +137,57 @@ public class CaseReviewFunctionalCaseService {
|
||||||
Map<String, String> versionMap = versions.stream().collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
Map<String, String> versionMap = versions.stream().collect(Collectors.toMap(ProjectVersion::getId, ProjectVersion::getName));
|
||||||
|
|
||||||
List<String> caseIds = list.stream().map(ReviewFunctionalCaseDTO::getCaseId).toList();
|
List<String> caseIds = list.stream().map(ReviewFunctionalCaseDTO::getCaseId).toList();
|
||||||
List<ReviewsDTO> reviewers = extCaseReviewFunctionalCaseUserMapper.selectReviewers(caseIds, reviewId);
|
List<ReviewsDTO> reviewers = extCaseReviewFunctionalCaseUserMapper.selectReviewers(caseIds, request.getReviewId());
|
||||||
Map<String, String> userIdMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserIds));
|
Map<String, String> userIdMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserIds));
|
||||||
Map<String, String> userNameMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserNames));
|
Map<String, String> userNameMap = reviewers.stream().collect(Collectors.toMap(ReviewsDTO::getCaseId, ReviewsDTO::getUserNames));
|
||||||
|
|
||||||
|
LinkedHashMap<String, List<CaseReviewHistory>> caseStatusMap;
|
||||||
|
LinkedHashMap<String, List<CaseReviewHistory>> caseUserMap;
|
||||||
|
if (request.isViewStatusFlag()) {
|
||||||
|
List<CaseReviewHistory> histories = extCaseReviewHistoryMapper.getReviewHistoryStatus(caseIds, request.getReviewId());
|
||||||
|
caseStatusMap = histories.stream().collect(Collectors.groupingBy(CaseReviewHistory::getCaseId, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
caseUserMap = histories.stream().collect(Collectors.groupingBy(CaseReviewHistory::getCreateUser, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
} else {
|
||||||
|
caseStatusMap = new LinkedHashMap<>();
|
||||||
|
caseUserMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
//当前用户的评审历史
|
||||||
|
List<CaseReviewHistory> userHistory = caseUserMap.get(userId);
|
||||||
|
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
item.setModuleName(moduleMap.get(item.getModuleId()));
|
item.setModuleName(moduleMap.get(item.getModuleId()));
|
||||||
item.setVersionName(versionMap.get(item.getVersionId()));
|
item.setVersionName(versionMap.get(item.getVersionId()));
|
||||||
item.setReviewers(Collections.singletonList(userIdMap.get(item.getCaseId())));
|
item.setReviewers(Collections.singletonList(userIdMap.get(item.getCaseId())));
|
||||||
item.setReviewNames(Collections.singletonList(userNameMap.get(item.getCaseId())));
|
item.setReviewNames(Collections.singletonList(userNameMap.get(item.getCaseId())));
|
||||||
|
|
||||||
|
if (request.isViewStatusFlag()) {
|
||||||
|
List<CaseReviewHistory> histories = caseStatusMap.get(item.getCaseId());
|
||||||
|
if (CollectionUtils.isNotEmpty(histories)) {
|
||||||
|
item.setMyStatus(getMyStatus(histories, userHistory));
|
||||||
|
} else {
|
||||||
|
//不存在评审历史
|
||||||
|
item.setMyStatus(FunctionalCaseReviewStatus.UNDER_REVIEWED.name());
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getMyStatus(List<CaseReviewHistory> histories, List<CaseReviewHistory> userHistory) {
|
||||||
|
if (CollectionUtils.isNotEmpty(userHistory)) {
|
||||||
|
//当前用户存在评审记录
|
||||||
|
return userHistory.get(0).getStatus();
|
||||||
|
}
|
||||||
|
//重新提审记录
|
||||||
|
List<CaseReviewHistory> reReviewed = histories.stream().filter(history -> StringUtils.equalsIgnoreCase(history.getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.name())).toList();
|
||||||
|
if (CollectionUtils.isNotEmpty(reReviewed)) {
|
||||||
|
return FunctionalCaseReviewStatus.RE_REVIEWED.name();
|
||||||
|
}
|
||||||
|
return FunctionalCaseReviewStatus.UN_REVIEWED.name();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
*
|
*
|
||||||
|
@ -334,11 +371,11 @@ public class CaseReviewFunctionalCaseService {
|
||||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||||
request.setReviewPassRule(caseReview.getReviewPassRule());
|
request.setReviewPassRule(caseReview.getReviewPassRule());
|
||||||
//检查权限
|
//检查权限
|
||||||
if (!permissionCheckService.userHasProjectPermission(userId, caseReview.getProjectId(), PermissionConstants.CASE_REVIEW_READ_UPDATE) && StringUtils.equalsIgnoreCase(request.getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString()) ) {
|
if (!permissionCheckService.userHasProjectPermission(userId, caseReview.getProjectId(), PermissionConstants.CASE_REVIEW_READ_UPDATE) && StringUtils.equalsIgnoreCase(request.getStatus(), FunctionalCaseReviewStatus.RE_REVIEWED.toString())) {
|
||||||
throw new MSException("http_result_forbidden");
|
throw new MSException("http_result_forbidden");
|
||||||
}
|
}
|
||||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCaseList = doCaseReviewFunctionalCases(request);
|
List<CaseReviewFunctionalCase> caseReviewFunctionalCaseList = doCaseReviewFunctionalCases(request);
|
||||||
if(CollectionUtils.isEmpty(caseReviewFunctionalCaseList)) {
|
if (CollectionUtils.isEmpty(caseReviewFunctionalCaseList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<String> caseIds = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getCaseId).toList();
|
List<String> caseIds = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getCaseId).toList();
|
||||||
|
@ -369,7 +406,7 @@ public class CaseReviewFunctionalCaseService {
|
||||||
Map<String, String> statusMap = new HashMap<>();
|
Map<String, String> statusMap = new HashMap<>();
|
||||||
|
|
||||||
//重新提审,作废之前的记录
|
//重新提审,作废之前的记录
|
||||||
extCaseReviewHistoryMapper.batchUpdateAbandoned(reviewId,caseIds);
|
extCaseReviewHistoryMapper.batchUpdateAbandoned(reviewId, caseIds);
|
||||||
|
|
||||||
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
||||||
//校验当前操作人是否是该用例的评审人或者是系统管理员,是增加评审历史,不是过滤掉
|
//校验当前操作人是否是该用例的评审人或者是系统管理员,是增加评审历史,不是过滤掉
|
||||||
|
@ -639,7 +676,7 @@ public class CaseReviewFunctionalCaseService {
|
||||||
List<FunctionalCaseModuleDTO> functionalModuleIds = extFunctionalCaseModuleMapper.selectBaseByProjectIdAndReviewId(reviewId);
|
List<FunctionalCaseModuleDTO> functionalModuleIds = extFunctionalCaseModuleMapper.selectBaseByProjectIdAndReviewId(reviewId);
|
||||||
Map<String, List<FunctionalCaseModuleDTO>> projectModuleMap = functionalModuleIds.stream().collect(Collectors.groupingBy(FunctionalCaseModule::getProjectId));
|
Map<String, List<FunctionalCaseModuleDTO>> projectModuleMap = functionalModuleIds.stream().collect(Collectors.groupingBy(FunctionalCaseModule::getProjectId));
|
||||||
if (MapUtils.isEmpty(projectModuleMap)) {
|
if (MapUtils.isEmpty(projectModuleMap)) {
|
||||||
projectRootMap.forEach((projectId,projectOptionDTOList)->{
|
projectRootMap.forEach((projectId, projectOptionDTOList) -> {
|
||||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName());
|
BaseTreeNode projectNode = new BaseTreeNode(projectId, projectOptionDTOList.get(0).getProjectName(), Project.class.getName());
|
||||||
returnList.add(projectNode);
|
returnList.add(projectNode);
|
||||||
BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
|
BaseTreeNode defaultNode = functionalCaseModuleService.getDefaultModule(Translator.get("functional_case.module.default.name"));
|
||||||
|
@ -647,7 +684,7 @@ public class CaseReviewFunctionalCaseService {
|
||||||
});
|
});
|
||||||
return returnList;
|
return returnList;
|
||||||
}
|
}
|
||||||
projectModuleMap.forEach((projectId,moduleList)->{
|
projectModuleMap.forEach((projectId, moduleList) -> {
|
||||||
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName());
|
BaseTreeNode projectNode = new BaseTreeNode(projectId, moduleList.get(0).getProjectName(), Project.class.getName());
|
||||||
returnList.add(projectNode);
|
returnList.add(projectNode);
|
||||||
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
|
List<String> projectModuleIds = moduleList.stream().map(FunctionalCaseModule::getId).toList();
|
||||||
|
@ -667,21 +704,21 @@ public class CaseReviewFunctionalCaseService {
|
||||||
List<FunctionalCaseModuleCountDTO> projectModuleCountDTOList = extCaseReviewFunctionalCaseMapper.countModuleIdByRequest(request, deleted, userId);
|
List<FunctionalCaseModuleCountDTO> projectModuleCountDTOList = extCaseReviewFunctionalCaseMapper.countModuleIdByRequest(request, deleted, userId);
|
||||||
Map<String, List<FunctionalCaseModuleCountDTO>> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId));
|
Map<String, List<FunctionalCaseModuleCountDTO>> projectCountMap = projectModuleCountDTOList.stream().collect(Collectors.groupingBy(FunctionalCaseModuleCountDTO::getProjectId));
|
||||||
Map<String, Long> projectModuleCountMap = new HashMap<>();
|
Map<String, Long> projectModuleCountMap = new HashMap<>();
|
||||||
projectCountMap.forEach((projectId,moduleCountDTOList)->{
|
projectCountMap.forEach((projectId, moduleCountDTOList) -> {
|
||||||
List<ModuleCountDTO>moduleCountDTOS = new ArrayList<>();
|
List<ModuleCountDTO> moduleCountDTOS = new ArrayList<>();
|
||||||
for (FunctionalCaseModuleCountDTO functionalCaseModuleCountDTO : moduleCountDTOList) {
|
for (FunctionalCaseModuleCountDTO functionalCaseModuleCountDTO : moduleCountDTOList) {
|
||||||
ModuleCountDTO moduleCountDTO = new ModuleCountDTO();
|
ModuleCountDTO moduleCountDTO = new ModuleCountDTO();
|
||||||
BeanUtils.copyBean(moduleCountDTO,functionalCaseModuleCountDTO);
|
BeanUtils.copyBean(moduleCountDTO, functionalCaseModuleCountDTO);
|
||||||
moduleCountDTOS.add(moduleCountDTO);
|
moduleCountDTOS.add(moduleCountDTO);
|
||||||
}
|
}
|
||||||
int sum = moduleCountDTOList.stream().mapToInt(FunctionalCaseModuleCountDTO::getDataCount).sum();
|
int sum = moduleCountDTOList.stream().mapToInt(FunctionalCaseModuleCountDTO::getDataCount).sum();
|
||||||
Map<String, Long> moduleCountMap = getModuleCountMap(projectId, request.getReviewId(), moduleCountDTOS);
|
Map<String, Long> moduleCountMap = getModuleCountMap(projectId, request.getReviewId(), moduleCountDTOS);
|
||||||
moduleCountMap.forEach((k,v)->{
|
moduleCountMap.forEach((k, v) -> {
|
||||||
if (projectModuleCountMap.get(k)==null || projectModuleCountMap.get(k) == 0L){
|
if (projectModuleCountMap.get(k) == null || projectModuleCountMap.get(k) == 0L) {
|
||||||
projectModuleCountMap.put(k,v);
|
projectModuleCountMap.put(k, v);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
projectModuleCountMap.put(projectId, (long)sum);
|
projectModuleCountMap.put(projectId, (long) sum);
|
||||||
});
|
});
|
||||||
//查出全部用例数量
|
//查出全部用例数量
|
||||||
long allCount = extCaseReviewFunctionalCaseMapper.caseCount(request, deleted, userId);
|
long allCount = extCaseReviewFunctionalCaseMapper.caseCount(request, deleted, userId);
|
||||||
|
|
|
@ -179,7 +179,7 @@ public class FunctionalCaseService {
|
||||||
|
|
||||||
//记录日志
|
//记录日志
|
||||||
FunctionalCaseHistoryLogDTO historyLogDTO = getImportLogModule(functionalCase);
|
FunctionalCaseHistoryLogDTO historyLogDTO = getImportLogModule(functionalCase);
|
||||||
saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(),OperationLogModule.CASE_MANAGEMENT_CASE_CREATE);
|
saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CREATE);
|
||||||
|
|
||||||
return functionalCase;
|
return functionalCase;
|
||||||
}
|
}
|
||||||
|
@ -962,7 +962,7 @@ public class FunctionalCaseService {
|
||||||
List<FunctionalCaseCustomField> customFields = functionalCaseCustomFieldMapper.selectByExample(fieldExample);
|
List<FunctionalCaseCustomField> customFields = functionalCaseCustomFieldMapper.selectByExample(fieldExample);
|
||||||
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, caseBlob, customFields, new ArrayList<>(), new ArrayList<>());
|
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, caseBlob, customFields, new ArrayList<>(), new ArrayList<>());
|
||||||
|
|
||||||
saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.IMPORT.name(),OperationLogModule.CASE_MANAGEMENT_CASE_CREATE);
|
saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.IMPORT.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1071,7 +1071,7 @@ public class FunctionalCaseService {
|
||||||
//记录新值
|
//记录新值
|
||||||
FunctionalCaseHistoryLogDTO modifiedLogDTO = getImportLogModule(functionalCase);
|
FunctionalCaseHistoryLogDTO modifiedLogDTO = getImportLogModule(functionalCase);
|
||||||
//记录日志
|
//记录日志
|
||||||
saveImportDataLog(functionalCase, originalValue, modifiedLogDTO, userId, organizationId, OperationLogType.IMPORT.name(),OperationLogModule.CASE_MANAGEMENT_CASE_UPDATE);
|
saveImportDataLog(functionalCase, originalValue, modifiedLogDTO, userId, organizationId, OperationLogType.IMPORT.name(), OperationLogModule.CASE_MANAGEMENT_CASE_UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleUpdateCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map<String, TemplateCustomFieldDTO> customFieldsMap) {
|
private void handleUpdateCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map<String, TemplateCustomFieldDTO> customFieldsMap) {
|
||||||
|
@ -1089,7 +1089,7 @@ public class FunctionalCaseService {
|
||||||
* @param originalValue 原值
|
* @param originalValue 原值
|
||||||
* @param modifiedLogDTO 新值
|
* @param modifiedLogDTO 新值
|
||||||
*/
|
*/
|
||||||
private void saveImportDataLog(FunctionalCase functionalCase, FunctionalCaseHistoryLogDTO originalValue, FunctionalCaseHistoryLogDTO modifiedLogDTO, String userId, String organizationId, String type,String module) {
|
private void saveImportDataLog(FunctionalCase functionalCase, FunctionalCaseHistoryLogDTO originalValue, FunctionalCaseHistoryLogDTO modifiedLogDTO, String userId, String organizationId, String type, String module) {
|
||||||
LogDTO dto = new LogDTO(
|
LogDTO dto = new LogDTO(
|
||||||
functionalCase.getProjectId(),
|
functionalCase.getProjectId(),
|
||||||
organizationId,
|
organizationId,
|
||||||
|
|
|
@ -54,9 +54,9 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
public static final String REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW = "/case/review/detail/batch/review";
|
public static final String REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW = "/case/review/detail/batch/review";
|
||||||
public static final String URL_MODULE_TREE = "/case/review/detail/tree/";
|
public static final String URL_MODULE_TREE = "/case/review/detail/tree/";
|
||||||
|
|
||||||
public static final String REVIEW_FUNCTIONAL_CASE_MODULE_COUNT= "/case/review/detail/module/count";
|
public static final String REVIEW_FUNCTIONAL_CASE_MODULE_COUNT = "/case/review/detail/module/count";
|
||||||
|
|
||||||
public static final String REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS= "/case/review/detail/reviewer/status/";
|
public static final String REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS = "/case/review/detail/reviewer/status/";
|
||||||
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -97,9 +97,18 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
@Sql(scripts = {"/dml/init_review_functional_case_test.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
@Sql(scripts = {"/dml/init_review_functional_case_test.sql"}, config = @SqlConfig(encoding = "utf-8", transactionMode = SqlConfig.TransactionMode.ISOLATED))
|
||||||
public void testReviewCasePage() throws Exception {
|
public void testReviewCasePage() throws Exception {
|
||||||
ReviewFunctionalCasePageRequest request = new ReviewFunctionalCasePageRequest();
|
ReviewFunctionalCasePageRequest request = new ReviewFunctionalCasePageRequest();
|
||||||
request.setReviewId("wx_review_id_1");
|
|
||||||
request.setCurrent(1);
|
request.setCurrent(1);
|
||||||
request.setPageSize(10);
|
request.setPageSize(10);
|
||||||
|
request.setProjectId("wx_test_project");
|
||||||
|
|
||||||
|
request.setReviewId("wx_review_id_5");
|
||||||
|
request.setViewFlag(true);
|
||||||
|
request.setViewStatusFlag(true);
|
||||||
|
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
||||||
|
request.setReviewId("wx_review_id_1");
|
||||||
|
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
||||||
|
|
||||||
|
request.setReviewId("wx_review_id_1");
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("customs", Arrays.asList(new LinkedHashMap() {{
|
map.put("customs", Arrays.asList(new LinkedHashMap() {{
|
||||||
put("id", "TEST_FIELD_ID");
|
put("id", "TEST_FIELD_ID");
|
||||||
|
@ -109,10 +118,11 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
}}));
|
}}));
|
||||||
request.setCombine(map);
|
request.setCombine(map);
|
||||||
request.setViewFlag(true);
|
request.setViewFlag(true);
|
||||||
request.setProjectId("wx_test_project");
|
request.setViewStatusFlag(true);
|
||||||
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
||||||
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_MODULE_COUNT, request);
|
this.requestPostWithOkAndReturn(REVIEW_FUNCTIONAL_CASE_MODULE_COUNT, request);
|
||||||
request.setViewFlag(false);
|
request.setViewFlag(false);
|
||||||
|
request.setViewStatusFlag(false);
|
||||||
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
this.requestPostWithOkAndReturn(REVIEW_CASE_PAGE, request);
|
||||||
|
|
||||||
request.setSort(new HashMap<>() {{
|
request.setSort(new HashMap<>() {{
|
||||||
|
@ -144,10 +154,10 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void emptyDataTest() throws Exception {
|
public void emptyDataTest() throws Exception {
|
||||||
List<BaseTreeNode> treeNodeDefaults = this.getCaseReviewModuleTreeNode("wx_test_project","wx_review_id_5");
|
List<BaseTreeNode> treeNodeDefaults = this.getCaseReviewModuleTreeNode("wx_test_project", "wx_review_id_5");
|
||||||
String jsonStringD = JSON.toJSONString(treeNodeDefaults);
|
String jsonStringD = JSON.toJSONString(treeNodeDefaults);
|
||||||
System.out.println(jsonStringD);
|
System.out.println(jsonStringD);
|
||||||
List<BaseTreeNode> treeNodes = this.getCaseReviewModuleTreeNode("wx_test_project","wx_review_id_2");
|
List<BaseTreeNode> treeNodes = this.getCaseReviewModuleTreeNode("wx_test_project", "wx_review_id_2");
|
||||||
String jsonString = JSON.toJSONString(treeNodes);
|
String jsonString = JSON.toJSONString(treeNodes);
|
||||||
System.out.println(jsonString);
|
System.out.println(jsonString);
|
||||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(treeNodes));
|
Assertions.assertTrue(CollectionUtils.isNotEmpty(treeNodes));
|
||||||
|
@ -291,7 +301,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
||||||
try {
|
try {
|
||||||
caseReviewFunctionalCaseService.batchReview(request, "GGG");
|
caseReviewFunctionalCaseService.batchReview(request, "GGG");
|
||||||
} catch (Exception e){
|
} catch (Exception e) {
|
||||||
Assertions.assertNotNull(e);
|
Assertions.assertNotNull(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,7 +384,6 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
this.requestPostWithOk(REVIEW_FUNCTIONAL_CASE_BATCH_REVIEW, request);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
request = new BatchReviewFunctionalCaseRequest();
|
request = new BatchReviewFunctionalCaseRequest();
|
||||||
request.setReviewId("wx_review_id_1");
|
request.setReviewId("wx_review_id_1");
|
||||||
request.setReviewPassRule(CaseReviewPassRule.MULTIPLE.toString());
|
request.setReviewPassRule(CaseReviewPassRule.MULTIPLE.toString());
|
||||||
|
@ -475,9 +484,9 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
@Test
|
@Test
|
||||||
@Order(11)
|
@Order(11)
|
||||||
public void getUserStatus() throws Exception {
|
public void getUserStatus() throws Exception {
|
||||||
List<OptionDTO> optionDTOS = getOptionDTOS("wx_review_id_1","gyq_case_id_5");
|
List<OptionDTO> optionDTOS = getOptionDTOS("wx_review_id_1", "gyq_case_id_5");
|
||||||
Assertions.assertTrue(CollectionUtils.isNotEmpty(optionDTOS));
|
Assertions.assertTrue(CollectionUtils.isNotEmpty(optionDTOS));
|
||||||
optionDTOS = getOptionDTOS("wx_review_id_1_NONE","gyq_case_id_5");
|
optionDTOS = getOptionDTOS("wx_review_id_1_NONE", "gyq_case_id_5");
|
||||||
Assertions.assertTrue(CollectionUtils.isEmpty(optionDTOS));
|
Assertions.assertTrue(CollectionUtils.isEmpty(optionDTOS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +509,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<OptionDTO> getOptionDTOS(String reviewId, String caseId) throws Exception {
|
private List<OptionDTO> getOptionDTOS(String reviewId, String caseId) throws Exception {
|
||||||
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS+"/"+reviewId+"/"+caseId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(REVIEW_FUNCTIONAL_CASE_REVIEWER_STATUS + "/" + reviewId + "/" + caseId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
|
@ -513,7 +522,7 @@ public class CaseReviewFunctionalCaseControllerTests extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
private List<BaseTreeNode> getCaseReviewModuleTreeNode(String projectId, String reviewId) throws Exception {
|
private List<BaseTreeNode> getCaseReviewModuleTreeNode(String projectId, String reviewId) throws Exception {
|
||||||
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(URL_MODULE_TREE+"/"+reviewId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get(URL_MODULE_TREE + "/" + reviewId).header(SessionConstants.HEADER_TOKEN, sessionId)
|
||||||
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
.header(SessionConstants.CSRF_TOKEN, csrfToken)
|
||||||
.header(SessionConstants.CURRENT_PROJECT, projectId)
|
.header(SessionConstants.CURRENT_PROJECT, projectId)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
|
|
|
@ -132,7 +132,9 @@ VALUES ('wx_history', 'wx_review_id_3', 'wx_case_id_1', NULL, 'PASS', b'0', b'0'
|
||||||
('wx_history_4', 'wx_review_id_4', 'wx_case_id_1', NULL, 'PASS', b'0', b'0', NULL, 'admin', 1669174143999),
|
('wx_history_4', 'wx_review_id_4', 'wx_case_id_1', NULL, 'PASS', b'0', b'0', NULL, 'admin', 1669174143999),
|
||||||
('wx_history_5', 'wx_review_id_4', 'wx_case_id_2', NULL, 'UN_PASS', b'0', b'0', NULL, 'admin', 1669174143999),
|
('wx_history_5', 'wx_review_id_4', 'wx_case_id_2', NULL, 'UN_PASS', b'0', b'0', NULL, 'admin', 1669174143999),
|
||||||
('wx_history_6', 'wx_review_id_1', 'gyq_case_id_5', NULL, 'PASS', b'0', b'0', NULL, 'gyq_case_review', 1669174143999),
|
('wx_history_6', 'wx_review_id_1', 'gyq_case_id_5', NULL, 'PASS', b'0', b'0', NULL, 'gyq_case_review', 1669174143999),
|
||||||
('wx_history_7', 'wx_review_id_1', 'gyq_case_id_5', NULL, 'UN_PASS', b'0', b'0', NULL, 'GGG', 1669174143999);
|
('wx_history_7', 'wx_review_id_1', 'gyq_case_id_5', NULL, 'UN_PASS', b'0', b'0', NULL, 'GGG', 1669174143999),
|
||||||
|
('wx_history_8', 'wx_review_id_1', 'wx_case_id_1', NULL, 'UN_PASS', b'0', b'0', NULL, 'admin', 1669174143999),
|
||||||
|
('wx_history_9', 'wx_review_id_5', 'gyq_case_id_d', NULL, 'RE_REVIEWED', b'0', b'0', NULL, 'GGG', 1669174143999);
|
||||||
|
|
||||||
INSERT INTO case_review_user(review_id, user_id)
|
INSERT INTO case_review_user(review_id, user_id)
|
||||||
VALUES ('wx_review_id_4', 'admin')
|
VALUES ('wx_review_id_4', 'admin')
|
|
@ -117,6 +117,7 @@ export interface ReviewListQueryParams extends TableQueryParams {
|
||||||
export interface ReviewDetailCaseListQueryParams extends TableQueryParams {
|
export interface ReviewDetailCaseListQueryParams extends TableQueryParams {
|
||||||
viewFlag: boolean; // 是否只看我的
|
viewFlag: boolean; // 是否只看我的
|
||||||
reviewId: string;
|
reviewId: string;
|
||||||
|
viewStatusFlag: boolean; // 我的评审状态
|
||||||
}
|
}
|
||||||
// 评审详情-用例拖拽排序入参
|
// 评审详情-用例拖拽排序入参
|
||||||
export interface SortReviewCaseParams {
|
export interface SortReviewCaseParams {
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
: t('caseManagement.caseReview.multi')
|
: t('caseManagement.caseReview.multi')
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-[16px] flex items-center">
|
<div v-show="reviewDetail.reviewPassRule === 'MULTIPLE'" class="ml-[16px] flex items-center">
|
||||||
<a-switch v-model:model-value="onlyMine" size="small" class="mr-[8px]" type="line" />
|
<a-switch v-model:model-value="onlyMineStatus" size="small" class="mr-[8px]" type="line" />
|
||||||
{{ t('caseManagement.caseReview.myReview') }}
|
{{ t('caseManagement.caseReview.myReviewStatus') }}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="flex h-full w-full border-t border-[var(--color-text-n8)]">
|
<div class="flex h-full w-full border-t border-[var(--color-text-n8)]">
|
||||||
|
@ -323,7 +323,8 @@
|
||||||
{ label: t(reviewResultMap.RE_REVIEWED.label), value: 'RE_REVIEWED' },
|
{ label: t(reviewResultMap.RE_REVIEWED.label), value: 'RE_REVIEWED' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const onlyMine = ref(false);
|
const viewFlag = ref(false);
|
||||||
|
const onlyMineStatus = ref(false);
|
||||||
const keyword = ref('');
|
const keyword = ref('');
|
||||||
const caseList = ref<ReviewCaseItem[]>([]);
|
const caseList = ref<ReviewCaseItem[]>([]);
|
||||||
const pageNation = ref({
|
const pageNation = ref({
|
||||||
|
@ -341,7 +342,8 @@
|
||||||
const res = await getReviewDetailCasePage({
|
const res = await getReviewDetailCasePage({
|
||||||
projectId: appStore.currentProjectId,
|
projectId: appStore.currentProjectId,
|
||||||
reviewId: reviewId.value,
|
reviewId: reviewId.value,
|
||||||
viewFlag: onlyMine.value,
|
viewFlag: viewFlag.value,
|
||||||
|
viewStatusFlag: onlyMineStatus.value,
|
||||||
keyword: keyword.value,
|
keyword: keyword.value,
|
||||||
current: pageNation.value.current || 1,
|
current: pageNation.value.current || 1,
|
||||||
pageSize: pageNation.value.pageSize,
|
pageSize: pageNation.value.pageSize,
|
||||||
|
@ -363,7 +365,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => onlyMine.value,
|
() => onlyMineStatus.value,
|
||||||
() => {
|
() => {
|
||||||
pageNation.value.current = 1;
|
pageNation.value.current = 1;
|
||||||
loadCaseList();
|
loadCaseList();
|
||||||
|
@ -566,7 +568,7 @@
|
||||||
total,
|
total,
|
||||||
pageSize,
|
pageSize,
|
||||||
current,
|
current,
|
||||||
onlyMine: _onlyMine,
|
viewFlag: _onlyMine,
|
||||||
keyword: _keyword,
|
keyword: _keyword,
|
||||||
combine,
|
combine,
|
||||||
sort,
|
sort,
|
||||||
|
@ -578,7 +580,7 @@
|
||||||
pageSize,
|
pageSize,
|
||||||
current,
|
current,
|
||||||
};
|
};
|
||||||
onlyMine.value = !!_onlyMine;
|
viewFlag.value = !!_onlyMine;
|
||||||
keyword.value = _keyword;
|
keyword.value = _keyword;
|
||||||
otherListQueryParams.value = {
|
otherListQueryParams.value = {
|
||||||
combine,
|
combine,
|
||||||
|
|
|
@ -111,7 +111,7 @@ export default {
|
||||||
'caseManagement.caseReview.append': 'Append',
|
'caseManagement.caseReview.append': 'Append',
|
||||||
'caseManagement.caseReview.appendTip1': 'Open: Add reviewer',
|
'caseManagement.caseReview.appendTip1': 'Open: Add reviewer',
|
||||||
'caseManagement.caseReview.appendTip2': 'Close: Update reviewers',
|
'caseManagement.caseReview.appendTip2': 'Close: Update reviewers',
|
||||||
'caseManagement.caseReview.myReview': 'My reviews',
|
'caseManagement.caseReview.myReviewStatus': 'My reviews status',
|
||||||
'caseManagement.caseReview.caseLevel': 'Case level',
|
'caseManagement.caseReview.caseLevel': 'Case level',
|
||||||
'caseManagement.caseReview.caseVersion': 'Case version',
|
'caseManagement.caseReview.caseVersion': 'Case version',
|
||||||
'caseManagement.caseReview.caseStatus': 'Case status',
|
'caseManagement.caseReview.caseStatus': 'Case status',
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default {
|
||||||
'caseManagement.caseReview.append': '追加',
|
'caseManagement.caseReview.append': '追加',
|
||||||
'caseManagement.caseReview.appendTip1': '开启:新增评审人',
|
'caseManagement.caseReview.appendTip1': '开启:新增评审人',
|
||||||
'caseManagement.caseReview.appendTip2': '关闭:更新评审人',
|
'caseManagement.caseReview.appendTip2': '关闭:更新评审人',
|
||||||
'caseManagement.caseReview.myReview': '我的评审',
|
'caseManagement.caseReview.myReviewStatus': '我的评审状态',
|
||||||
'caseManagement.caseReview.caseLevel': '用例等级',
|
'caseManagement.caseReview.caseLevel': '用例等级',
|
||||||
'caseManagement.caseReview.caseVersion': '用例版本',
|
'caseManagement.caseReview.caseVersion': '用例版本',
|
||||||
'caseManagement.caseReview.caseStatus': '用例状态',
|
'caseManagement.caseReview.caseStatus': '用例状态',
|
||||||
|
|
Loading…
Reference in New Issue