fix(用例评审): 修正评审后的用例评审状态以及用例数量的计算
This commit is contained in:
parent
edc4bcc010
commit
281e1e0b17
|
@ -5,23 +5,19 @@ public interface CaseEvent {
|
|||
interface Event {
|
||||
String ASSOCIATE = "associate";
|
||||
String DISASSOCIATE = "disassociate";
|
||||
String BATCH_DISASSOCIATE = "batchDisassociate";
|
||||
String DELETE_FUNCTIONAL_CASE = "deleteFunctionalCase";
|
||||
String DELETE_TRASH_FUNCTIONAL_CASE = "deleteTrashFunctionalCase";
|
||||
String RECOVER_FUNCTIONAL_CASE = "recoverFunctionalCase";
|
||||
String REVIEW_FUNCTIONAL_CASE = "reviewFunctionalCase";
|
||||
String BATCH_UPDATE_REVIEWER = "batchUpdateReviewer";
|
||||
}
|
||||
|
||||
interface Param {
|
||||
String REVIEW_ID = "reviewId";
|
||||
String CASE_IDS = "caseIds";
|
||||
String PASS_COUNT = "passCount";
|
||||
String CASE_COUNT = "caseCount";
|
||||
String STATUS = "status";
|
||||
String USER_ID = "userId";
|
||||
String UN_COMPLETED_COUNT = "unCompletedCount";
|
||||
String EVENT_NAME = "eventName";
|
||||
String COUNT_MAP = "countMap";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public interface ExtCaseReviewFunctionalCaseMapper {
|
|||
|
||||
List<CaseReviewFunctionalCase> getList(@Param("reviewId") String reviewId, @Param("reviewIds") List<String> reviewIds, @Param("deleted") boolean deleted);
|
||||
|
||||
List<CaseReviewFunctionalCase> getListIncludes(@Param("reviewId") String reviewId, @Param("caseIds") List<String> caseIds, @Param("deleted") boolean deleted);
|
||||
|
||||
List<CaseReviewFunctionalCase> getListExcludes(@Param("reviewIds") List<String> reviewIds, @Param("caseIds") List<String> caseIds, @Param("deleted") boolean deleted);
|
||||
|
||||
|
|
|
@ -331,25 +331,6 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListIncludes" resultType="io.metersphere.functional.domain.CaseReviewFunctionalCase">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
case_review_functional_case crfc
|
||||
LEFT JOIN functional_case fc ON crfc.case_id = fc.id
|
||||
WHERE
|
||||
fc.deleted = #{deleted}
|
||||
<if test="reviewId != null and reviewId != ''">
|
||||
and crfc.review_id = #{reviewId}
|
||||
</if>
|
||||
<if test="caseIds != null and caseIds.size() > 0">
|
||||
and fc.id in
|
||||
<foreach collection="caseIds" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListExcludes" resultType="io.metersphere.functional.domain.CaseReviewFunctionalCase">
|
||||
SELECT
|
||||
*
|
||||
|
|
|
@ -12,15 +12,12 @@ import io.metersphere.sdk.util.LogUtils;
|
|||
import io.metersphere.system.notice.constants.NoticeConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
@ -39,6 +36,17 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
@Resource
|
||||
private ExtCaseReviewHistoryMapper extCaseReviewHistoryMapper;
|
||||
|
||||
public static final String UN_REVIEWED_COUNT = "unReviewedCount";
|
||||
|
||||
public static final String UNDER_REVIEWED_COUNT = "underReviewedCount";
|
||||
|
||||
public static final String PASS_COUNT = "passCount";
|
||||
|
||||
public static final String UN_PASS_COUNT = "unPassCount";
|
||||
|
||||
public static final String RE_REVIEWED_COUNT = "reReviewedCount";
|
||||
|
||||
|
||||
@Async
|
||||
@Override
|
||||
public void updateCaseReview(Map<String, Object> paramMap) {
|
||||
|
@ -46,36 +54,15 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
switch (event) {
|
||||
case CaseEvent.Event.ASSOCIATE -> updateCaseReviewByAssociate(paramMap);
|
||||
case CaseEvent.Event.DISASSOCIATE -> updateCaseReviewByDisAssociate(paramMap);
|
||||
case CaseEvent.Event.BATCH_DISASSOCIATE -> updateCaseReviewByBatchDisassociate(paramMap);
|
||||
case CaseEvent.Event.DELETE_FUNCTIONAL_CASE -> updateCaseReviewByDeleteFunctionalCase(paramMap);
|
||||
case CaseEvent.Event.DELETE_TRASH_FUNCTIONAL_CASE -> updateCaseReviewByDeleteTrashFunctionalCase(paramMap);
|
||||
case CaseEvent.Event.RECOVER_FUNCTIONAL_CASE -> updateCaseReviewByRecoverFunctionalCase(paramMap);
|
||||
case CaseEvent.Event.REVIEW_FUNCTIONAL_CASE -> updateCaseReviewByReviewFunctionalCase(paramMap);
|
||||
case CaseEvent.Event.BATCH_UPDATE_REVIEWER -> updateCaseReviewByBatchUpdateReviewer(paramMap);
|
||||
default -> LogUtils.info("CaseProvider: " + event);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量修改评审人 重新计算通过率和用例数
|
||||
*
|
||||
* @param paramMap paramMap
|
||||
*/
|
||||
private void updateCaseReviewByBatchUpdateReviewer(Map<String, Object> paramMap) {
|
||||
try {
|
||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||
int caseCount = Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString());
|
||||
int passCount = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
||||
int unCompletedCaseCount = Integer.parseInt(paramMap.get(CaseEvent.Param.UN_COMPLETED_COUNT).toString());
|
||||
updateCaseReview(reviewId, caseCount, passCount, unCompletedCaseCount, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.BATCH_UPDATE_REVIEWER + "事件更新失败", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 1.关联用例(单独/批量)重新计算用例评审的通过率和用例数
|
||||
*/
|
||||
|
@ -85,12 +72,13 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
//获取关联前的caseIds
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListIncludes(reviewId, caseIdList, false);
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
int caseCount = Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()) + caseReviewFunctionalCases.size();
|
||||
int passNumber = passList.size();
|
||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||
updateCaseReview(reviewId, caseCount, passNumber, unCompletedCaseList.size() + Integer.parseInt(paramMap.get(CaseEvent.Param.CASE_COUNT).toString()), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
List<CaseReviewFunctionalCase> beforeCaseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(List.of(reviewId), caseIdList, false);
|
||||
int caseCount = caseIdList.size() + beforeCaseReviewFunctionalCases.size();
|
||||
Map<String, Integer> mapCount = getCaseCountMap(beforeCaseReviewFunctionalCases);
|
||||
//新关联的都是未评审的,这里加上
|
||||
Integer i = mapCount.get(UN_REVIEWED_COUNT);
|
||||
mapCount.put(UN_REVIEWED_COUNT,i+caseIdList.size());
|
||||
updateCaseReview(reviewId, caseCount, mapCount, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.ASSOCIATE + "事件更新失败", e.getMessage());
|
||||
}
|
||||
|
@ -112,11 +100,9 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
//获取与选中case无关的其他case
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(List.of(reviewId), caseIdList, false);
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
int caseCount = caseReviewFunctionalCases.size();
|
||||
int passNumber = passList.size();
|
||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||
updateCaseReview(reviewId, caseReview.getCaseCount() - caseCount, passNumber, unCompletedCaseList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
Map<String, Integer> caseCountMap = getCaseCountMap(caseReviewFunctionalCases);
|
||||
updateCaseReview(reviewId, caseCount, caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
//删除用例和用例评审人的关系
|
||||
deleteCaseReviewFunctionalCaseUser(paramMap);
|
||||
//将评审历史状态置为true
|
||||
|
@ -127,39 +113,15 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* 3.
|
||||
* 1.批量取消关联重新计算用例评审的通过率和用例数
|
||||
* 2.删除用例和用例评审人的关系
|
||||
*/
|
||||
private void updateCaseReviewByBatchDisassociate(Map<String, Object> paramMap) {
|
||||
try {
|
||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||
CaseReview caseReviewOld = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
Integer oldCaseCount = caseReviewOld.getCaseCount();
|
||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
if (CollectionUtils.isEmpty(caseIdList)) {
|
||||
return;
|
||||
}
|
||||
int passNumber = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
||||
int unCompletedCount = Integer.parseInt(paramMap.get(CaseEvent.Param.UN_COMPLETED_COUNT).toString());
|
||||
updateCaseReview(reviewId, oldCaseCount - caseIdList.size(), passNumber, unCompletedCount, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
//删除用例和用例评审人的关系
|
||||
deleteCaseReviewFunctionalCaseUser(paramMap);
|
||||
//将评审历史状态置为true
|
||||
extCaseReviewHistoryMapper.updateDelete(caseIdList, reviewId, true);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.BATCH_DISASSOCIATE + "事件更新失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 4.功能用例的删除/批量删除重新计算用例评审的通过率和用例数
|
||||
* 3.功能用例的删除/批量删除重新计算用例评审的通过率和用例数
|
||||
*/
|
||||
private void updateCaseReviewByDeleteFunctionalCase(Map<String, Object> paramMap) {
|
||||
try {
|
||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
if (CollectionUtils.isEmpty(caseIdList)) {
|
||||
return;
|
||||
}
|
||||
startUpdateCaseReview(paramMap, caseIdList);
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.DELETE_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||
|
@ -167,13 +129,18 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* 5.功能用例的回收站删除/批量删除重新计算用例评审的通过率和用例数
|
||||
* 4.功能用例的回收站删除/批量删除重新计算用例评审的通过率和用例数
|
||||
*/
|
||||
private void updateCaseReviewByDeleteTrashFunctionalCase(Map<String, Object> paramMap) {
|
||||
try {
|
||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
//要被删除的caseIds
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
if (CollectionUtils.isEmpty(caseIdList)) {
|
||||
return;
|
||||
}
|
||||
if (startUpdateCaseReview(paramMap, caseIdList)) return;
|
||||
//删除关联关系
|
||||
CaseReviewFunctionalCaseUserExample caseReviewFunctionalCaseUserExample = new CaseReviewFunctionalCaseUserExample();
|
||||
caseReviewFunctionalCaseUserExample.createCriteria().andCaseIdIn(caseIdList);
|
||||
caseReviewFunctionalCaseUserMapper.deleteByExample(caseReviewFunctionalCaseUserExample);
|
||||
|
@ -187,12 +154,15 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
}
|
||||
|
||||
/**
|
||||
* 6.功能用例的回收站恢复/批量恢复重新计算用例评审的通过率和用例数
|
||||
* 5.功能用例的回收站恢复/批量恢复重新计算用例评审的通过率和用例数
|
||||
*/
|
||||
private void updateCaseReviewByRecoverFunctionalCase(Map<String, Object> paramMap) {
|
||||
try {
|
||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
if(CollectionUtils.isEmpty(caseIdList)){
|
||||
return;
|
||||
}
|
||||
CaseReviewFunctionalCaseExample functionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
functionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
||||
List<CaseReviewFunctionalCase> recoverCases = caseReviewFunctionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
|
@ -201,6 +171,7 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
}
|
||||
List<String> reviewIds = recoverCases.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList();
|
||||
Map<String, List<CaseReviewFunctionalCase>> recoverCaseMap = recoverCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(reviewIds, caseIdList, false);
|
||||
Map<String, List<CaseReviewFunctionalCase>> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||
CaseReviewExample caseReviewExample = new CaseReviewExample();
|
||||
|
@ -215,10 +186,8 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
} else {
|
||||
caseReviewFunctionalCaseList = recoverCaseList;
|
||||
}
|
||||
List<String> ids = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getId).toList();
|
||||
List<CaseReviewFunctionalCase> unCompleteList = getUnCompletedCaseList(caseReviewFunctionalCaseList, ids);
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
updateCaseReview(reviewId, caseReview.getCaseCount() + caseReviewFunctionalCaseList.size(), passList.size(), unCompleteList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
Map<String, Integer> caseCountMap = getCaseCountMap(caseReviewFunctionalCaseList);
|
||||
updateCaseReview(reviewId, caseReviewFunctionalCaseList.size(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.RECOVER_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||
|
@ -226,110 +195,134 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 7.评审用例/批量评审用例重新计算用例评审的通过率和用例评审状态和发送通知
|
||||
* 6.评审用例/批量评审用例重新计算用例评审的通过率和用例评审状态和发送通知
|
||||
*/
|
||||
private void updateCaseReviewByReviewFunctionalCase(Map<String, Object> paramMap) {
|
||||
try {
|
||||
String reviewId = paramMap.get(CaseEvent.Param.REVIEW_ID).toString();
|
||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
if (caseReview == null) {
|
||||
return;
|
||||
}
|
||||
Object caseIds = paramMap.get(CaseEvent.Param.CASE_IDS);
|
||||
List<String> caseIdList = JSON.parseArray(JSON.toJSONString(caseIds), String.class);
|
||||
if(CollectionUtils.isEmpty(caseIdList)){
|
||||
return;
|
||||
}
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(List.of(reviewId), caseIdList, false);
|
||||
List<CaseReviewFunctionalCase> unCompletedCaseList = getUnCompletedCaseList(caseReviewFunctionalCases, new ArrayList<>());
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
Map<String, Integer> caseCountMap = getCaseCountMap(caseReviewFunctionalCases);
|
||||
Object mapCount = paramMap.get(CaseEvent.Param.COUNT_MAP);
|
||||
Map<String,Integer> map = JSON.parseMap(JSON.toJSONString(mapCount));
|
||||
updateMapCount(map, caseCountMap);
|
||||
updateCaseReview(reviewId, caseReview.getCaseCount(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
|
||||
CaseReview caseReview = caseReviewMapper.selectByPrimaryKey(reviewId);
|
||||
boolean completed = false;
|
||||
|
||||
String status = paramMap.get(CaseEvent.Param.STATUS).toString();
|
||||
List<String> completedStatusList = new ArrayList<>();
|
||||
completedStatusList.add(FunctionalCaseReviewStatus.PASS.toString());
|
||||
completedStatusList.add(FunctionalCaseReviewStatus.UN_PASS.toString());
|
||||
if (!completedStatusList.contains(status) || CollectionUtils.isNotEmpty(unCompletedCaseList)) {
|
||||
caseReview.setStatus(CaseReviewStatus.UNDERWAY.toString());
|
||||
} else {
|
||||
completed = true;
|
||||
caseReview.setStatus(CaseReviewStatus.COMPLETED.toString());
|
||||
}
|
||||
int passNumber = passList.size();
|
||||
|
||||
int pass = Integer.parseInt(paramMap.get(CaseEvent.Param.PASS_COUNT).toString());
|
||||
passNumber += pass;
|
||||
//通过率
|
||||
BigDecimal passCount = BigDecimal.valueOf(passNumber);
|
||||
BigDecimal totalCount = BigDecimal.valueOf(caseReview.getCaseCount());
|
||||
if (totalCount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
caseReview.setPassRate(BigDecimal.ZERO);
|
||||
} else {
|
||||
BigDecimal passRate = passCount.divide(totalCount, 2, RoundingMode.HALF_UP);
|
||||
caseReview.setPassRate(passRate);
|
||||
}
|
||||
caseReviewMapper.updateByPrimaryKeySelective(caseReview);
|
||||
|
||||
if (completed) {
|
||||
reviewSendNoticeService.sendNotice(new ArrayList<>(), paramMap.get(CaseEvent.Param.USER_ID).toString(), reviewId, NoticeConstants.TaskType.CASE_REVIEW_TASK, NoticeConstants.Event.REVIEW_COMPLETED);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogUtils.error(CaseEvent.Event.REVIEW_FUNCTIONAL_CASE + "事件更新失败", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void updateMapCount(Map<String, Integer> map, Map<String, Integer> caseCountMap) {
|
||||
if (map.get(FunctionalCaseReviewStatus.UN_REVIEWED.toString()) != null) {
|
||||
Integer i = caseCountMap.get(UN_REVIEWED_COUNT);
|
||||
caseCountMap.put(UN_REVIEWED_COUNT, map.get(FunctionalCaseReviewStatus.UN_REVIEWED.toString())+i);
|
||||
}
|
||||
if (map.get(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()) != null) {
|
||||
Integer i = caseCountMap.get(UNDER_REVIEWED_COUNT);
|
||||
caseCountMap.put(UNDER_REVIEWED_COUNT, map.get(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString())+i);
|
||||
}
|
||||
if (map.get(FunctionalCaseReviewStatus.PASS.toString()) != null) {
|
||||
Integer i = caseCountMap.get(PASS_COUNT);
|
||||
caseCountMap.put(PASS_COUNT, map.get(FunctionalCaseReviewStatus.PASS.toString())+i);
|
||||
}
|
||||
if (map.get(FunctionalCaseReviewStatus.UN_PASS.toString()) != null) {
|
||||
Integer i = caseCountMap.get(UN_PASS_COUNT);
|
||||
caseCountMap.put(UN_PASS_COUNT, map.get(FunctionalCaseReviewStatus.UN_PASS.toString())+i);
|
||||
}
|
||||
if (map.get(FunctionalCaseReviewStatus.RE_REVIEWED.toString()) != null) {
|
||||
Integer i = caseCountMap.get(RE_REVIEWED_COUNT);
|
||||
caseCountMap.put(RE_REVIEWED_COUNT, map.get(FunctionalCaseReviewStatus.RE_REVIEWED.toString())+i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 准备更新caseReview
|
||||
*/
|
||||
private boolean startUpdateCaseReview(Map<String, Object> paramMap, List<String> caseIdList) {
|
||||
CaseReviewFunctionalCaseExample functionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
functionalCaseExample.createCriteria().andCaseIdIn(caseIdList);
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalReviews = caseReviewFunctionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
if (CollectionUtils.isEmpty(caseReviewFunctionalReviews)) {
|
||||
List<CaseReviewFunctionalCase> deletedCaseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(functionalCaseExample);
|
||||
if (CollectionUtils.isEmpty(deletedCaseReviewFunctionalCases)) {
|
||||
return true;
|
||||
}
|
||||
Map<String, List<CaseReviewFunctionalCase>> caseReviewMap = caseReviewFunctionalReviews.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||
List<String> reviewIds = caseReviewFunctionalReviews.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList();
|
||||
List<String> reviewIds = deletedCaseReviewFunctionalCases.stream().map(CaseReviewFunctionalCase::getReviewId).distinct().toList();
|
||||
//获取与选中case无关的关联关系
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getListExcludes(reviewIds, caseIdList, false);
|
||||
Map<String, List<CaseReviewFunctionalCase>> reviewIdMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId));
|
||||
CaseReviewExample caseReviewExample = new CaseReviewExample();
|
||||
caseReviewExample.createCriteria().andIdIn(reviewIds);
|
||||
List<CaseReview> caseReviews = caseReviewMapper.selectByExample(caseReviewExample);
|
||||
Map<String, CaseReview> reviewMap = caseReviews.stream().collect(Collectors.toMap(CaseReview::getId, t -> t));
|
||||
reviewIdMap.forEach((reviewId, caseReviewFunctionalCaseList) -> {
|
||||
List<String> ids = caseReviewFunctionalCaseList.stream().map(CaseReviewFunctionalCase::getId).toList();
|
||||
CaseReview caseReview = reviewMap.get(reviewId);
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases1 = caseReviewMap.get(reviewId);
|
||||
List<CaseReviewFunctionalCase> unCompleteList = getUnCompletedCaseList(caseReviewFunctionalCaseList, ids);
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCaseList.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
updateCaseReview(reviewId, caseReview.getCaseCount() - caseReviewFunctionalCases1.size(), passList.size(), unCompleteList.size(), paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
Map<String, Integer> caseCountMap = getCaseCountMap(caseReviewFunctionalCaseList);
|
||||
updateCaseReview(reviewId, caseReviewFunctionalCaseList.size(), caseCountMap, paramMap.get(CaseEvent.Param.USER_ID).toString());
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取未评审完成的用例
|
||||
* 处理数据库还存在关联关系获取用例各种状态的数据
|
||||
*/
|
||||
private static List<CaseReviewFunctionalCase> getUnCompletedCaseList(List<CaseReviewFunctionalCase> caseReviewFunctionalCases, List<String> ids) {
|
||||
List<String> statusList = new ArrayList<>();
|
||||
statusList.add(FunctionalCaseReviewStatus.UN_REVIEWED.toString());
|
||||
statusList.add(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString());
|
||||
statusList.add(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
||||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
return caseReviewFunctionalCases.stream().filter(t -> statusList.contains(t.getStatus()) && !ids.contains(t.getId())).toList();
|
||||
private static Map<String, Integer> getCaseCountMap(List<CaseReviewFunctionalCase> caseReviewFunctionalCases) {
|
||||
Map<String, Integer> mapCount = new HashMap<>();
|
||||
Map<String, List<CaseReviewFunctionalCase>> caseMap = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getStatus));
|
||||
if (caseMap.get(FunctionalCaseReviewStatus.UN_REVIEWED.toString()) != null) {
|
||||
mapCount.put(UN_REVIEWED_COUNT, caseMap.get(FunctionalCaseReviewStatus.UN_REVIEWED.toString()).size());
|
||||
} else {
|
||||
return caseReviewFunctionalCases.stream().filter(t -> statusList.contains(t.getStatus())).toList();
|
||||
mapCount.put(UN_REVIEWED_COUNT, 0);
|
||||
}
|
||||
|
||||
if (caseMap.get(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()) != null) {
|
||||
mapCount.put(UNDER_REVIEWED_COUNT, caseMap.get(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()).size());
|
||||
} else {
|
||||
mapCount.put(UNDER_REVIEWED_COUNT, 0);
|
||||
}
|
||||
|
||||
if (caseMap.get(FunctionalCaseReviewStatus.PASS.toString()) != null) {
|
||||
mapCount.put(PASS_COUNT, caseMap.get(FunctionalCaseReviewStatus.PASS.toString()).size());
|
||||
} else {
|
||||
mapCount.put(PASS_COUNT, 0);
|
||||
}
|
||||
|
||||
if (caseMap.get(FunctionalCaseReviewStatus.UN_PASS.toString()) != null) {
|
||||
mapCount.put(UN_PASS_COUNT, caseMap.get(FunctionalCaseReviewStatus.UN_PASS.toString()).size());
|
||||
} else {
|
||||
mapCount.put(UN_PASS_COUNT, 0);
|
||||
}
|
||||
|
||||
if (caseMap.get(FunctionalCaseReviewStatus.RE_REVIEWED.toString()) != null) {
|
||||
mapCount.put(RE_REVIEWED_COUNT, caseMap.get(FunctionalCaseReviewStatus.RE_REVIEWED.toString()).size());
|
||||
} else {
|
||||
mapCount.put(RE_REVIEWED_COUNT, 0);
|
||||
}
|
||||
|
||||
return mapCount;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新计算用例评审的通过率和用例数以及评审状态
|
||||
*
|
||||
* @param reviewId 当前用例评审的ID
|
||||
* @param caseCount 用例评审上显示的用例数量总和
|
||||
* @param mapCount 功能用例各种状态的数量map
|
||||
* @param userId 操作人
|
||||
*/
|
||||
private void updateCaseReview(String reviewId, int caseCount, int passNumber, int unCompleteCount, String userId) {
|
||||
private void updateCaseReview(String reviewId, int caseCount, Map<String, Integer> mapCount, String userId) {
|
||||
CaseReview caseReview = new CaseReview();
|
||||
caseReview.setId(reviewId);
|
||||
//更新用例数量
|
||||
caseReview.setCaseCount(caseCount);
|
||||
//通过率
|
||||
BigDecimal passCount = BigDecimal.valueOf(passNumber);
|
||||
BigDecimal passCount = BigDecimal.valueOf(mapCount.get(PASS_COUNT));
|
||||
BigDecimal totalCount = BigDecimal.valueOf(caseReview.getCaseCount());
|
||||
if (totalCount.compareTo(BigDecimal.ZERO) == 0) {
|
||||
caseReview.setPassRate(BigDecimal.ZERO);
|
||||
|
@ -338,11 +331,20 @@ public class CaseReviewCaseProvider implements BaseCaseProvider {
|
|||
caseReview.setPassRate(passRate);
|
||||
}
|
||||
boolean completed = false;
|
||||
if (unCompleteCount > 0) {
|
||||
//1.如果都是未评审,则用例评审状态为未开始
|
||||
//2.如果都是已完成状态(通过/不通过),则用例评审状态为已完成
|
||||
//3.如果有未评审/重新提审状态/评审中数量>1,则是评审中
|
||||
Integer unPassCount = mapCount.get(UN_PASS_COUNT);
|
||||
Integer unReviewedCount = mapCount.get(UN_REVIEWED_COUNT);
|
||||
Integer underReviewedCount = mapCount.get(UNDER_REVIEWED_COUNT);
|
||||
Integer reReviewedCount = mapCount.get(RE_REVIEWED_COUNT);
|
||||
if (Objects.equals(unReviewedCount, caseReview.getCaseCount())) {
|
||||
caseReview.setStatus(CaseReviewStatus.PREPARED.toString());
|
||||
} else if ((unReviewedCount + underReviewedCount + reReviewedCount) > 0) {
|
||||
caseReview.setStatus(CaseReviewStatus.UNDERWAY.toString());
|
||||
} else {
|
||||
completed = true;
|
||||
} else if ((mapCount.get(PASS_COUNT) + unPassCount) == caseReview.getCaseCount()) {
|
||||
caseReview.setStatus(CaseReviewStatus.COMPLETED.toString());
|
||||
completed = true;
|
||||
}
|
||||
caseReviewMapper.updateByPrimaryKeySelective(caseReview);
|
||||
if (completed) {
|
||||
|
|
|
@ -7,11 +7,11 @@ import lombok.Data;
|
|||
@Data
|
||||
public class BatchReviewFunctionalCaseRequest extends BaseReviewCaseBatchRequest{
|
||||
|
||||
@Schema(description = "评审规则")
|
||||
@Schema(description = "评审规则:单人评审(SINGLE)/多人评审(MULTIPLE)")
|
||||
@NotBlank(message = "{case_review.review_pass_rule.not_blank}")
|
||||
private String reviewPassRule;
|
||||
|
||||
@Schema(description = "评审结果")
|
||||
@Schema(description = "评审结果:未评审(UN_REVIEWED)/评审中(UNDER_REVIEWED)/PASS(通过)/UN_PASS(未通过)/RE_REVIEWED(重新提审)")
|
||||
@NotBlank(message = "{functional_case.status.not_blank}")
|
||||
private String status;
|
||||
|
||||
|
|
|
@ -136,30 +136,17 @@ public class CaseReviewFunctionalCaseService extends ModuleTreeService {
|
|||
if (CollectionUtils.isNotEmpty(ids)) {
|
||||
CaseReviewFunctionalCaseExample example = new CaseReviewFunctionalCaseExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
Map<String, Object> param = getParam(request.getReviewId(), ids);
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.BATCH_DISASSOCIATE);
|
||||
provider.updateCaseReview(param);
|
||||
caseReviewFunctionalCaseMapper.deleteByExample(example);
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put(CaseEvent.Param.REVIEW_ID, request.getReviewId());
|
||||
param.put(CaseEvent.Param.CASE_IDS, ids);
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.DISASSOCIATE);
|
||||
provider.updateCaseReview(param);
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> getParam(String reviewId, List<String> ids) {
|
||||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = extCaseReviewFunctionalCaseMapper.getList(reviewId, null, false);
|
||||
List<CaseReviewFunctionalCase> passList = caseReviewFunctionalCases.stream().filter(t -> !ids.contains(t.getId()) && StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
List<String> statusList = new ArrayList<>();
|
||||
statusList.add(FunctionalCaseReviewStatus.UN_REVIEWED.toString());
|
||||
statusList.add(FunctionalCaseReviewStatus.UNDER_REVIEWED.toString());
|
||||
statusList.add(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
||||
List<CaseReviewFunctionalCase> unCompletedCaseList = caseReviewFunctionalCases.stream().filter(t -> !ids.contains(t.getId()) && statusList.contains(t.getStatus())).toList();
|
||||
List<String> list = caseReviewFunctionalCases.stream().filter(t -> ids.contains(t.getId())).map(CaseReviewFunctionalCase::getCaseId).toList();
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(list) ? list : new ArrayList<>());
|
||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||
param.put(CaseEvent.Param.PASS_COUNT, CollectionUtils.isNotEmpty(passList) ? passList.size() : 0);
|
||||
param.put(CaseEvent.Param.UN_COMPLETED_COUNT, CollectionUtils.isNotEmpty(unCompletedCaseList) ? unCompletedCaseList.size() : 0);
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
public List<String> doSelectIds(BaseReviewCaseBatchRequest request) {
|
||||
if (request.isSelectAll()) {
|
||||
|
@ -292,7 +279,6 @@ public class CaseReviewFunctionalCaseService extends ModuleTreeService {
|
|||
CaseReviewHistoryMapper caseReviewHistoryMapper = sqlSession.getMapper(CaseReviewHistoryMapper.class);
|
||||
CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class);
|
||||
|
||||
int passCount = 0;
|
||||
for (CaseReviewFunctionalCase caseReviewFunctionalCase : caseReviewFunctionalCaseList) {
|
||||
String caseId = caseReviewFunctionalCase.getCaseId();
|
||||
CaseReviewHistory caseReviewHistory = buildCaseReviewHistory(request, userId, caseId);
|
||||
|
@ -306,9 +292,7 @@ public class CaseReviewFunctionalCaseService extends ModuleTreeService {
|
|||
}
|
||||
//根据评审规则更新用例评审和功能用例关系表中的状态 1.单人评审直接更新评审结果 2.多人评审需要计算
|
||||
setStatus(request, caseReviewFunctionalCase, caseHistoryMap, reviewerMap);
|
||||
if (StringUtils.equalsIgnoreCase(caseReviewFunctionalCase.getStatus(), FunctionalCaseReviewStatus.PASS.toString())) {
|
||||
passCount += 1;
|
||||
}
|
||||
|
||||
caseReviewFunctionalCaseMapper.updateByPrimaryKeySelective(caseReviewFunctionalCase);
|
||||
|
||||
//检查是否有@,发送@通知
|
||||
|
@ -328,12 +312,17 @@ public class CaseReviewFunctionalCaseService extends ModuleTreeService {
|
|||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
Map<String, List<CaseReviewFunctionalCase>> collect = caseReviewFunctionalCaseList.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getStatus));
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
collect.forEach((k,v)->{
|
||||
countMap.put(k,v.size());
|
||||
});
|
||||
param.put(CaseEvent.Param.CASE_IDS, CollectionUtils.isNotEmpty(caseIds) ? caseIds : new ArrayList<>());
|
||||
param.put(CaseEvent.Param.PASS_COUNT, passCount);
|
||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.REVIEW_FUNCTIONAL_CASE);
|
||||
param.put(CaseEvent.Param.COUNT_MAP, countMap);
|
||||
provider.updateCaseReview(param);
|
||||
}
|
||||
|
||||
|
@ -439,17 +428,17 @@ public class CaseReviewFunctionalCaseService extends ModuleTreeService {
|
|||
});
|
||||
sqlSession.flushStatements();
|
||||
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
|
||||
|
||||
Map<String, List<CaseReviewFunctionalCase>> collect = cases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getStatus));
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
collect.forEach((k,v)->{
|
||||
countMap.put(k,v.size());
|
||||
});
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
List<CaseReviewFunctionalCase> list = extCaseReviewFunctionalCaseMapper.getList(request.getReviewId(), null, false);
|
||||
List<CaseReviewFunctionalCase> passList = list.stream().filter(t -> StringUtils.equalsIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.PASS.toString())).toList();
|
||||
List<CaseReviewFunctionalCase> unCompletedCaseList = list.stream().filter(t -> StringUtils.equalsAnyIgnoreCase(t.getStatus(), FunctionalCaseReviewStatus.UN_REVIEWED.toString(), FunctionalCaseReviewStatus.UNDER_REVIEWED.toString(), FunctionalCaseReviewStatus.RE_REVIEWED.toString())).toList();
|
||||
param.put(CaseEvent.Param.REVIEW_ID, request.getReviewId());
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.CASE_COUNT, list.size());
|
||||
param.put(CaseEvent.Param.PASS_COUNT, passList.size());
|
||||
param.put(CaseEvent.Param.UN_COMPLETED_COUNT, unCompletedCaseList.size());
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.BATCH_UPDATE_REVIEWER);
|
||||
param.put(CaseEvent.Param.CASE_IDS, caseIds);
|
||||
param.put(CaseEvent.Param.COUNT_MAP, countMap);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.REVIEW_FUNCTIONAL_CASE);
|
||||
provider.updateCaseReview(param);
|
||||
}
|
||||
|
||||
|
|
|
@ -478,8 +478,7 @@ public class CaseReviewService {
|
|||
Map<String, Object> param = new HashMap<>();
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.REVIEW_ID, caseReviewId);
|
||||
param.put(CaseEvent.Param.CASE_IDS, castIds);
|
||||
param.put(CaseEvent.Param.CASE_COUNT, CollectionUtils.isNotEmpty(caseRealIds) ? caseRealIds.size() : 0);
|
||||
param.put(CaseEvent.Param.CASE_IDS, caseRealIds);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.ASSOCIATE);
|
||||
provider.updateCaseReview(param);
|
||||
}
|
||||
|
|
|
@ -68,10 +68,6 @@ public class ReviewFunctionalCaseService {
|
|||
String functionalCaseStatus = getFunctionalCaseStatus(request, hasReviewedUserMap);
|
||||
extCaseReviewFunctionalCaseMapper.updateStatus(caseId, reviewId, functionalCaseStatus);
|
||||
caseReviewHistoryMapper.insert(caseReviewHistory);
|
||||
int passCount = 0;
|
||||
if (StringUtils.equalsIgnoreCase(FunctionalCaseReviewStatus.PASS.toString(),functionalCaseStatus)) {
|
||||
passCount=1;
|
||||
}
|
||||
|
||||
//检查是否有@,发送@通知
|
||||
if (StringUtils.isNotBlank(request.getNotifier())) {
|
||||
|
@ -86,11 +82,13 @@ public class ReviewFunctionalCaseService {
|
|||
reviewSendNoticeService.sendNoticeCase(new ArrayList<>(), userId, caseId, NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, NoticeConstants.Event.REVIEW_PASSED, reviewId);
|
||||
}
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
Map<String, Integer> countMap = new HashMap<>();
|
||||
countMap.put(functionalCaseStatus,1);
|
||||
param.put(CaseEvent.Param.CASE_IDS, List.of(caseId));
|
||||
param.put(CaseEvent.Param.PASS_COUNT,passCount);
|
||||
param.put(CaseEvent.Param.REVIEW_ID, reviewId);
|
||||
param.put(CaseEvent.Param.STATUS, request.getStatus());
|
||||
param.put(CaseEvent.Param.USER_ID, userId);
|
||||
param.put(CaseEvent.Param.COUNT_MAP,countMap);
|
||||
param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.REVIEW_FUNCTIONAL_CASE);
|
||||
provider.updateCaseReview(param);
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ public class CaseReviewControllerTests extends BaseTest {
|
|||
|
||||
request = new CaseReviewPageRequest();
|
||||
filters = new HashMap<>();
|
||||
filters.put("status", Arrays.asList("UNDERWAY", "COMPLETED", "ARCHIVED"));
|
||||
filters.put("status", Arrays.asList("PREPARED", "COMPLETED", "ARCHIVED"));
|
||||
request.setFilter(filters);
|
||||
request.setCombine(caseReviewCombine);
|
||||
request.setProjectId(projectId);
|
||||
|
|
|
@ -105,6 +105,26 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
caseReviews1 = getCaseReviews("创建用例评审1");
|
||||
Assertions.assertTrue(StringUtils.equals(caseReviews1.get(0).getStatus(), CaseReviewStatus.COMPLETED.toString()));
|
||||
|
||||
reviewFunctionalCaseRequest = new ReviewFunctionalCaseRequest();
|
||||
reviewFunctionalCaseRequest.setReviewId(reviewId);
|
||||
reviewFunctionalCaseRequest.setCaseId("gyqReviewCaseTestOne");
|
||||
reviewFunctionalCaseRequest.setProjectId(projectId);
|
||||
reviewFunctionalCaseRequest.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString());
|
||||
reviewFunctionalCaseRequest.setContent("不通过");
|
||||
reviewFunctionalCaseRequest.setNotifier("default-project-member-user-gyq-2;");
|
||||
reviewFunctionalCaseRequest.setReviewPassRule(CaseReviewPassRule.SINGLE.toString());
|
||||
this.requestPostWithOk(SAVE_REVIEW, reviewFunctionalCaseRequest);
|
||||
caseReviewHistoryExample = new CaseReviewHistoryExample();
|
||||
caseReviewHistoryExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewHistories = caseReviewHistoryMapper.selectByExample(caseReviewHistoryExample);
|
||||
Assertions.assertEquals(2, caseReviewHistories.size());
|
||||
caseReviewFunctionalCaseExample = new CaseReviewFunctionalCaseExample();
|
||||
caseReviewFunctionalCaseExample.createCriteria().andReviewIdEqualTo(reviewId).andCaseIdEqualTo("gyqReviewCaseTestOne");
|
||||
caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(),FunctionalCaseReviewStatus.RE_REVIEWED.toString()));
|
||||
caseReviews1 = getCaseReviews("创建用例评审1");
|
||||
Assertions.assertTrue(StringUtils.equals(caseReviews1.get(0).getStatus(), CaseReviewStatus.UNDERWAY.toString()));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -136,7 +156,7 @@ public class ReviewFunctionalCaseControllerTests extends BaseTest {
|
|||
List<CaseReviewFunctionalCase> caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(caseReviewFunctionalCaseExample);
|
||||
Assertions.assertTrue(StringUtils.equalsIgnoreCase(caseReviewFunctionalCases.get(0).getStatus(),FunctionalCaseReviewStatus.UNDER_REVIEWED.toString()));
|
||||
List<CaseReview> caseReviews1 = getCaseReviews("创建用例评审2");
|
||||
Assertions.assertTrue(StringUtils.equals(caseReviews1.get(0).getStatus(), CaseReviewStatus.COMPLETED.toString()));
|
||||
Assertions.assertTrue(StringUtils.equals(caseReviews1.get(0).getStatus(), CaseReviewStatus.UNDERWAY.toString()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue