refactor(用例评审): 关联功能用例增加全选功能
This commit is contained in:
parent
df52fff6c9
commit
24b6d9b5f2
|
@ -24,6 +24,7 @@ public interface ExtCaseReviewFunctionalCaseMapper {
|
|||
|
||||
List<ReviewFunctionalCaseDTO> page(@Param("request") ReviewFunctionalCasePageRequest request, @Param("deleted") boolean deleted, @Param("userId") String userId, @Param("sort") String sort);
|
||||
|
||||
Long getPos(@Param("reviewId") String reviewId);
|
||||
|
||||
List<String> getIds(@Param("request") BaseReviewCaseBatchRequest request, @Param("userId") String userId, @Param("deleted") boolean deleted);
|
||||
}
|
||||
|
|
|
@ -274,4 +274,16 @@
|
|||
1=1
|
||||
</sql>
|
||||
|
||||
<select id="getPos" resultType="java.lang.Long">
|
||||
SELECT
|
||||
pos
|
||||
FROM
|
||||
case_review_functional_case
|
||||
WHERE
|
||||
review_id = #{reviewId}
|
||||
ORDER BY
|
||||
pos DESC
|
||||
LIMIT 1;
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -83,6 +83,21 @@
|
|||
<property name="searchMode" value="request.condition.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="request.createByMe != null">
|
||||
case_review.create_user = #{request.createByMe}
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<if test="request.reviewByMe != null">
|
||||
case_review.id in
|
||||
(
|
||||
select case_review_user.review_id from case_review_user where case_review_user.user_id = #{request.reviewByMe}
|
||||
)
|
||||
<include refid="queryType">
|
||||
<property name="searchMode" value="request.searchMode"/>
|
||||
</include>
|
||||
</if>
|
||||
<include refid="filters">
|
||||
<property name="filter" value="request.condition.filter"/>
|
||||
</include>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package io.metersphere.functional.request;
|
||||
|
||||
import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BaseAssociateCaseRequest extends BaseFunctionalCaseBatchDTO {
|
||||
|
||||
@Schema(description = "功能用例选择的项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{case_review_associate_request.project_id.not_blank}")
|
||||
private String projectId;
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ package io.metersphere.functional.request;
|
|||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -14,7 +15,6 @@ import java.util.List;
|
|||
*/
|
||||
@Data
|
||||
public class CaseReviewAssociateRequest implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -22,16 +22,16 @@ public class CaseReviewAssociateRequest implements Serializable {
|
|||
@NotBlank(message = "{case_review_associate_request.case_review_id.not_blank}")
|
||||
private String reviewId;
|
||||
|
||||
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "用例评审所在的项目id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{case_review_associate_request.project_id.not_blank}")
|
||||
private String projectId;
|
||||
|
||||
@Schema(description = "功能用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "{case_review_associate_request.case_ids.not_empty}")
|
||||
private List<String> caseIds;
|
||||
|
||||
@Schema(description = "评审人")
|
||||
@NotEmpty(message = "{case_review_associate_request.user_ids.not_empty}")
|
||||
private List<String> reviewers;
|
||||
|
||||
@Schema(description = "查询功能用例的条件")
|
||||
@NotNull(message = "{case_review_associate_request.base_associate_case_request.not_null}")
|
||||
private BaseAssociateCaseRequest baseAssociateCaseRequest;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,4 +26,10 @@ public class CaseReviewBatchRequest extends TableBatchProcessDTO implements Seri
|
|||
@Schema(description = "模块id")
|
||||
private List<String> moduleIds;
|
||||
|
||||
@Schema(description = "我评审的")
|
||||
private String reviewByMe;
|
||||
|
||||
@Schema(description = "我创建的")
|
||||
private String createByMe;
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public class CaseReviewRequest implements Serializable {
|
|||
@NotBlank(message = "{case_review.name.not_blank}")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "模块id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "用例评审的模块id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "{case_review.module_id.not_blank}")
|
||||
private String moduleId;
|
||||
|
||||
|
@ -52,6 +52,6 @@ public class CaseReviewRequest implements Serializable {
|
|||
@NotEmpty(message = "{case_review.reviewers.not_empty}")
|
||||
private List<String> reviewers;
|
||||
|
||||
@Schema(description = "关联的用例id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<String> caseIds;
|
||||
@Schema(description = "查询功能用例的条件")
|
||||
private BaseAssociateCaseRequest baseAssociateCaseRequest;
|
||||
}
|
||||
|
|
|
@ -4,9 +4,12 @@ import io.metersphere.functional.domain.CaseReview;
|
|||
import io.metersphere.functional.domain.CaseReviewFunctionalCase;
|
||||
import io.metersphere.functional.domain.FunctionalCase;
|
||||
import io.metersphere.functional.domain.FunctionalCaseExample;
|
||||
import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
||||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.CaseReviewMapper;
|
||||
import io.metersphere.functional.mapper.ExtFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.FunctionalCaseMapper;
|
||||
import io.metersphere.functional.request.BaseAssociateCaseRequest;
|
||||
import io.metersphere.functional.request.BaseReviewCaseBatchRequest;
|
||||
import io.metersphere.functional.request.CaseReviewAssociateRequest;
|
||||
import io.metersphere.functional.request.CaseReviewRequest;
|
||||
|
@ -41,6 +44,8 @@ public class CaseReviewLogService {
|
|||
|
||||
@Resource
|
||||
private CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper;
|
||||
@Resource
|
||||
private ExtFunctionalCaseMapper extFunctionalCaseMapper;
|
||||
|
||||
/**
|
||||
* 新增用例评审 日志
|
||||
|
@ -144,7 +149,11 @@ public class CaseReviewLogService {
|
|||
return null;
|
||||
}
|
||||
List<LogDTO> dtoList = new ArrayList<>();
|
||||
List<String> caseIds = request.getCaseIds();
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = request.getBaseAssociateCaseRequest();
|
||||
List<String> caseIds = doSelectIds(baseAssociateCaseRequest, baseAssociateCaseRequest.getProjectId());
|
||||
if (CollectionUtils.isEmpty(caseIds)) {
|
||||
return null;
|
||||
}
|
||||
FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample();
|
||||
functionalCaseExample.createCriteria().andIdIn(caseIds);
|
||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
|
@ -221,4 +230,17 @@ public class CaseReviewLogService {
|
|||
return dtoList;
|
||||
}
|
||||
|
||||
public <T> List<String> doSelectIds(T dto, String projectId) {
|
||||
BaseFunctionalCaseBatchDTO request = (BaseFunctionalCaseBatchDTO) dto;
|
||||
if (request.isSelectAll()) {
|
||||
List<String> ids = extFunctionalCaseMapper.getIds(request, projectId, false);
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
ids.removeAll(request.getExcludeIds());
|
||||
}
|
||||
return ids;
|
||||
} else {
|
||||
return request.getSelectIds();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,13 +4,11 @@ package io.metersphere.functional.service;
|
|||
import io.metersphere.functional.constants.CaseReviewStatus;
|
||||
import io.metersphere.functional.constants.FunctionalCaseReviewStatus;
|
||||
import io.metersphere.functional.domain.*;
|
||||
import io.metersphere.functional.dto.BaseFunctionalCaseBatchDTO;
|
||||
import io.metersphere.functional.dto.CaseReviewDTO;
|
||||
import io.metersphere.functional.dto.CaseReviewUserDTO;
|
||||
import io.metersphere.functional.mapper.*;
|
||||
import io.metersphere.functional.request.CaseReviewAssociateRequest;
|
||||
import io.metersphere.functional.request.CaseReviewBatchRequest;
|
||||
import io.metersphere.functional.request.CaseReviewPageRequest;
|
||||
import io.metersphere.functional.request.CaseReviewRequest;
|
||||
import io.metersphere.functional.request.*;
|
||||
import io.metersphere.functional.result.CaseManagementResultCode;
|
||||
import io.metersphere.project.dto.ModuleCountDTO;
|
||||
import io.metersphere.sdk.constants.ApplicationNumScope;
|
||||
|
@ -75,7 +73,11 @@ public class CaseReviewService {
|
|||
@Resource
|
||||
private CaseReviewFunctionalCaseUserMapper caseReviewFunctionalCaseUserMapper;
|
||||
@Resource
|
||||
private ExtCaseReviewFunctionalCaseMapper extCaseReviewFunctionalCaseMapper;
|
||||
@Resource
|
||||
private CaseReviewModuleService caseReviewModuleService;
|
||||
@Resource
|
||||
private ExtFunctionalCaseMapper extFunctionalCaseMapper;
|
||||
|
||||
|
||||
private static final String CASE_MODULE_COUNT_ALL = "all";
|
||||
|
@ -200,7 +202,9 @@ public class CaseReviewService {
|
|||
*/
|
||||
public void addCaseReview(CaseReviewRequest request, String userId) {
|
||||
String caseReviewId = IDGenerator.nextStr();
|
||||
addCaseReview(request, userId, caseReviewId);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = request.getBaseAssociateCaseRequest();
|
||||
List<String> caseIds = doSelectIds(baseAssociateCaseRequest, baseAssociateCaseRequest.getProjectId());
|
||||
addCaseReview(request, userId, caseReviewId, caseIds);
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
CaseReviewUserMapper mapper = sqlSession.getMapper(CaseReviewUserMapper.class);
|
||||
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
||||
|
@ -209,9 +213,9 @@ public class CaseReviewService {
|
|||
//保存和评审人的关系
|
||||
addCaseReviewUser(request, caseReviewId, mapper);
|
||||
//保存和用例的关系
|
||||
addCaseReviewFunctionalCase(request.getCaseIds(), request.getProjectId(), userId, caseReviewId, caseReviewFunctionalCaseMapper);
|
||||
addCaseReviewFunctionalCase(caseIds, request.getProjectId(), userId, caseReviewId, caseReviewFunctionalCaseMapper);
|
||||
//保存用例和用例评审人的关系
|
||||
addCaseReviewFunctionalCaseUser(request.getCaseIds(), request.getReviewers(), caseReviewId, caseReviewFunctionalCaseUserMapper);
|
||||
addCaseReviewFunctionalCaseUser(caseIds, request.getReviewers(), caseReviewId, caseReviewFunctionalCaseUserMapper);
|
||||
sqlSession.flushStatements();
|
||||
} finally {
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
|
@ -316,7 +320,7 @@ public class CaseReviewService {
|
|||
* @param userId 当前操作人
|
||||
* @param caseReviewId 用例评审id
|
||||
*/
|
||||
private void addCaseReview(CaseReviewRequest request, String userId, String caseReviewId) {
|
||||
private void addCaseReview(CaseReviewRequest request, String userId, String caseReviewId, List<String> caseIds) {
|
||||
CaseReview caseReview = new CaseReview();
|
||||
caseReview.setId(caseReviewId);
|
||||
caseReview.setNum(getNextNum(request.getProjectId()));
|
||||
|
@ -330,10 +334,10 @@ public class CaseReviewService {
|
|||
caseReview.setTags(JSON.toJSONString(request.getTags()));
|
||||
}
|
||||
caseReview.setPassRate(BigDecimal.valueOf(0.00));
|
||||
if (CollectionUtils.isEmpty(request.getCaseIds())) {
|
||||
if (CollectionUtils.isEmpty(caseIds)) {
|
||||
caseReview.setCaseCount(0);
|
||||
} else {
|
||||
caseReview.setCaseCount(request.getCaseIds().size());
|
||||
caseReview.setCaseCount(caseIds.size());
|
||||
}
|
||||
caseReview.setStartTime(request.getStartTime());
|
||||
caseReview.setEndTime(request.getEndTime());
|
||||
|
@ -350,8 +354,6 @@ public class CaseReviewService {
|
|||
* @param caseReviewId 用例评审id
|
||||
*/
|
||||
private CaseReview checkCaseReview(String caseReviewId) {
|
||||
CaseReviewExample caseReviewExample = new CaseReviewExample();
|
||||
caseReviewExample.createCriteria().andIdEqualTo(caseReviewId);
|
||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(caseReviewId);
|
||||
if (caseReview == null) {
|
||||
throw new MSException(CaseManagementResultCode.CASE_REVIEW_NOT_FOUND);
|
||||
|
@ -368,6 +370,15 @@ public class CaseReviewService {
|
|||
return (pos == null ? 0 : pos) + POS_STEP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param caseReviewId 用例评审id
|
||||
* @return pos
|
||||
*/
|
||||
public Long getCaseFunctionalCaseNextPos(String caseReviewId) {
|
||||
Long pos = extCaseReviewFunctionalCaseMapper.getPos(caseReviewId);
|
||||
return (pos == null ? 0 : pos) + POS_STEP;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param projectId 项目id
|
||||
* @return num
|
||||
|
@ -396,7 +407,7 @@ public class CaseReviewService {
|
|||
caseReviewFunctionalCase.setCreateTime(System.currentTimeMillis());
|
||||
caseReviewFunctionalCase.setUpdateTime(System.currentTimeMillis());
|
||||
caseReviewFunctionalCase.setId(IDGenerator.nextStr());
|
||||
caseReviewFunctionalCase.setPos(getNextPos(projectId));
|
||||
caseReviewFunctionalCase.setPos(getCaseFunctionalCaseNextPos(caseReviewId));
|
||||
caseReviewFunctionalCaseMapper.insert(caseReviewFunctionalCase);
|
||||
});
|
||||
}
|
||||
|
@ -428,8 +439,13 @@ public class CaseReviewService {
|
|||
public void associateCase(CaseReviewAssociateRequest request, String userId) {
|
||||
String caseReviewId = request.getReviewId();
|
||||
CaseReview caseReviewExist = checkCaseReview(caseReviewId);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = request.getBaseAssociateCaseRequest();
|
||||
List<String> caseIds = doSelectIds(baseAssociateCaseRequest, baseAssociateCaseRequest.getProjectId());
|
||||
if (CollectionUtils.isEmpty(caseIds)) {
|
||||
return;
|
||||
}
|
||||
FunctionalCaseExample functionalCaseExample = new FunctionalCaseExample();
|
||||
functionalCaseExample.createCriteria().andIdIn(request.getCaseIds());
|
||||
functionalCaseExample.createCriteria().andIdIn(caseIds);
|
||||
List<FunctionalCase> functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
if (CollectionUtils.isEmpty(functionalCases)) {
|
||||
return;
|
||||
|
@ -438,7 +454,7 @@ public class CaseReviewService {
|
|||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(caseReviewId);
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
List<String> castIds = caseReviewFunctionalCases.stream().map(CaseReviewFunctionalCase::getCaseId).toList();
|
||||
List<String> caseRealIds = request.getCaseIds().stream().filter(t -> !castIds.contains(t)).toList();
|
||||
List<String> caseRealIds = caseIds.stream().filter(t -> !castIds.contains(t)).toList();
|
||||
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
|
||||
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
||||
CaseReviewFunctionalCaseUserMapper caseReviewFunctionalCaseUserMapper = sqlSession.getMapper(CaseReviewFunctionalCaseUserMapper.class);
|
||||
|
@ -464,6 +480,19 @@ public class CaseReviewService {
|
|||
caseReviewMapper.updateByPrimaryKeySelective(caseReview);
|
||||
}
|
||||
|
||||
public <T> List<String> doSelectIds(T dto, String projectId) {
|
||||
BaseFunctionalCaseBatchDTO request = (BaseFunctionalCaseBatchDTO) dto;
|
||||
if (request.isSelectAll()) {
|
||||
List<String> ids = extFunctionalCaseMapper.getIds(request, projectId, false);
|
||||
if (CollectionUtils.isNotEmpty(request.getExcludeIds())) {
|
||||
ids.removeAll(request.getExcludeIds());
|
||||
}
|
||||
return ids;
|
||||
} else {
|
||||
return request.getSelectIds();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用例评审列表拖拽排序
|
||||
*
|
||||
|
|
|
@ -127,6 +127,9 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewRequest.setName(name);
|
||||
caseReviewRequest.setModuleId("CASE_REVIEW_REAL_MODULE_ID");
|
||||
caseReviewRequest.setReviewPassRule(reviewPassRule);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(false);
|
||||
List<String> reviewers = new ArrayList<>();
|
||||
reviewers.add("admin");
|
||||
if (reviewer) {
|
||||
|
@ -135,13 +138,14 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
if (StringUtils.isNotBlank(caseId)) {
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
caseIds.add(caseId);
|
||||
caseReviewRequest.setCaseIds(caseIds);
|
||||
baseAssociateCaseRequest.setSelectIds(caseIds);
|
||||
}
|
||||
if (tag) {
|
||||
List<String> tags = new ArrayList<>();
|
||||
tags.add("11");
|
||||
caseReviewRequest.setTags(tags);
|
||||
}
|
||||
caseReviewRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
return caseReviewRequest;
|
||||
}
|
||||
|
||||
|
@ -276,13 +280,11 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviewId);
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID2");
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID3");
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID4");
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID5");
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID6");
|
||||
caseReviewAssociateRequest.setCaseIds(caseIds);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(true);
|
||||
baseAssociateCaseRequest.setExcludeIds(List.of("CASE_REVIEW_TEST_GYQ_ID"));
|
||||
caseReviewAssociateRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add("gyq_review_test");
|
||||
userIds.add("gyq_review_test2");
|
||||
|
@ -307,9 +309,10 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId("caseReviewIdXXXX");
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID2");
|
||||
caseReviewAssociateRequest.setCaseIds(caseIds);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(true);
|
||||
caseReviewAssociateRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add("gyq_review_test");
|
||||
userIds.add("gyq_review_test2");
|
||||
|
@ -319,9 +322,25 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId());
|
||||
caseIds = new ArrayList<>();
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_XX");
|
||||
caseReviewAssociateRequest.setCaseIds(caseIds);
|
||||
baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(false);
|
||||
baseAssociateCaseRequest.setSelectIds(List.of("CASE_REVIEW_TEST_GYQ_XX"));
|
||||
caseReviewAssociateRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
userIds = new ArrayList<>();
|
||||
userIds.add("gyq_review_test");
|
||||
userIds.add("gyq_review_test2");
|
||||
caseReviewAssociateRequest.setReviewers(userIds);
|
||||
this.requestPostWithOk(ASSOCIATE_CASE_REVIEW, caseReviewAssociateRequest);
|
||||
|
||||
caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviews.get(0).getId());
|
||||
baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId("project-gyq-case-review-testYY");
|
||||
baseAssociateCaseRequest.setSelectAll(true);
|
||||
baseAssociateCaseRequest.setSelectIds(List.of("CASE_REVIEW_TEST_GYQ_XX"));
|
||||
caseReviewAssociateRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
userIds = new ArrayList<>();
|
||||
userIds.add("gyq_review_test");
|
||||
userIds.add("gyq_review_test2");
|
||||
|
@ -509,15 +528,15 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
request.setSelectAll(false);
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
request.setSelectAll(true);
|
||||
request.setExcludeIds(List.of(caseReviews.get(0).getId()));
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
String moduleIdNew = caseReviews.get(0).getModuleId();
|
||||
Assertions.assertFalse(StringUtils.equals(moduleId, moduleIdNew));
|
||||
Assertions.assertTrue(StringUtils.equals(moduleId, moduleIdNew));
|
||||
request = new CaseReviewBatchRequest();
|
||||
request.setProjectId(projectId);
|
||||
request.setMoveModuleId("CASE_REVIEW_REAL_MODULE_ID2");
|
||||
request.setSelectAll(false);
|
||||
request.setExcludeIds(List.of(caseReviews.get(0).getId()));
|
||||
this.requestPostWithOkAndReturn(BATCH_MOVE_CASE_REVIEW, request);
|
||||
caseReviews = getCaseReviews("创建评审更新1");
|
||||
String moduleIdNewOne = caseReviews.get(0).getModuleId();
|
||||
|
@ -533,6 +552,8 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
notificationExample.createCriteria().andResourceTypeEqualTo(NoticeConstants.TaskType.CASE_REVIEW_TASK).andResourceIdEqualTo(caseReviews.get(0).getId()).andOperationEqualTo("DELETE");
|
||||
List<Notification> notifications = notificationMapper.selectByExampleWithBLOBs(notificationExample);
|
||||
Assertions.assertEquals(1, notifications.size());
|
||||
|
||||
delCaseReview("caseReviewIdX");
|
||||
}
|
||||
|
||||
|
||||
|
@ -563,9 +584,11 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
CaseReviewAssociateRequest caseReviewAssociateRequest = new CaseReviewAssociateRequest();
|
||||
caseReviewAssociateRequest.setProjectId(projectId);
|
||||
caseReviewAssociateRequest.setReviewId(caseReviewId);
|
||||
List<String> caseIds = new ArrayList<>();
|
||||
caseIds.add("CASE_REVIEW_TEST_GYQ_ID2");
|
||||
caseReviewAssociateRequest.setCaseIds(caseIds);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectAll(false);
|
||||
baseAssociateCaseRequest.setSelectIds(List.of("CASE_REVIEW_TEST_GYQ_ID2"));
|
||||
caseReviewAssociateRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.add("gyq_review_test");
|
||||
userIds.add("gyq_review_test2");
|
||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.functional.dto.CaseReviewHistoryDTO;
|
|||
import io.metersphere.functional.mapper.CaseReviewFunctionalCaseMapper;
|
||||
import io.metersphere.functional.mapper.CaseReviewHistoryMapper;
|
||||
import io.metersphere.functional.mapper.CaseReviewMapper;
|
||||
import io.metersphere.functional.request.BaseAssociateCaseRequest;
|
||||
import io.metersphere.functional.request.CaseReviewRequest;
|
||||
import io.metersphere.functional.request.ReviewFunctionalCaseRequest;
|
||||
import io.metersphere.project.domain.Notification;
|
||||
|
@ -255,7 +256,11 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
caseReviewRequest.setModuleId("CASE_REVIEW_REAL_MODULE_ID");
|
||||
caseReviewRequest.setReviewPassRule(CaseReviewPassRule.SINGLE.toString());
|
||||
caseReviewRequest.setReviewers(reviewers);
|
||||
caseReviewRequest.setCaseIds(caseIds);
|
||||
BaseAssociateCaseRequest baseAssociateCaseRequest = new BaseAssociateCaseRequest();
|
||||
baseAssociateCaseRequest.setSelectAll(false);
|
||||
baseAssociateCaseRequest.setProjectId(projectId);
|
||||
baseAssociateCaseRequest.setSelectIds(caseIds);
|
||||
caseReviewRequest.setBaseAssociateCaseRequest(baseAssociateCaseRequest);
|
||||
List<String> tags = new ArrayList<>();
|
||||
tags.add("11");
|
||||
caseReviewRequest.setTags(tags);
|
||||
|
|
|
@ -9,22 +9,22 @@ INSERT INTO template (id, name, remark, internal, update_time, create_time, crea
|
|||
VALUES ('test_template_case_review_gyq_id', 'functional_case_review_gyq', '', b'0', 1696992836000, 1696992836000, 'admin', 'PROJECT', 'project-gyq-case-review-test', b'0', NULL, 'FUNCTIONAL');
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试1', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试1', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID2', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试2', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID2', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID2', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试2', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID2', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID3', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试3', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID3', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID3', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试3', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID3', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID4', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试4', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID4', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID4', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试4', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID4', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID5', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试5', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID5', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID5', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试5', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID5', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case(id, num, module_id, project_id, template_id, name, review_status, tags, case_edit_type, pos, version_id, ref_id, last_execute_result, deleted, public_case, latest, create_user, update_user, delete_user, create_time, update_time, delete_time)
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID6', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试6', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID6', 'UN_EXECUTED', true, b'0', b'0', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
VALUES ('CASE_REVIEW_TEST_GYQ_ID6', 1, 'CASE_REVIEW_TEST_MODULE_ID', 'project-gyq-case-review-test', '100001', '关联需求测试6', 'UN_REVIEWED', NULL, 'STEP', 0, 'v1.0.0', 'CASE_REVIEW_TEST_GYQ_ID6', 'UN_EXECUTED', false, b'0', b'1', 'gyq', 'gyq', '', 1698058347559, 1698058347559, NULL);
|
||||
|
||||
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('CASE_REVIEW_TEST_GYQ_ID', 'gyq_custom_id_review1', '22');
|
||||
INSERT INTO functional_case_custom_field(case_id, field_id, value) VALUES ('CASE_REVIEW_TEST_GYQ_ID', 'gyq_custom_id_review2', '33');
|
||||
|
|
Loading…
Reference in New Issue