refactor(测试计划): 测试规划脑图保存删除处理逻辑修改

This commit is contained in:
guoyuqi 2024-06-16 13:02:46 +08:00 committed by 刘瑞斌
parent 603c7d8ac8
commit e72a3d4418
2 changed files with 6 additions and 5 deletions

View File

@ -272,7 +272,7 @@ public class TestPlanCollectionMinderService {
if (CollectionUtils.isNotEmpty(updateList)) {
//处理删除
deleteCollection(updateList);
deleteCollection(updateList, request.getPlanId());
//处理更新
for (TestPlanCollectionMinderEditDTO testPlanCollectionMinderEditDTO : updateList) {
TestPlanCollection testPlanCollection = updateCollection(request, userId, testPlanCollectionMinderEditDTO, parentMap, collectionMapper);
@ -281,10 +281,10 @@ public class TestPlanCollectionMinderService {
}
}
private void deleteCollection(List<TestPlanCollectionMinderEditDTO> updateList) {
private void deleteCollection(List<TestPlanCollectionMinderEditDTO> updateList, String planId) {
List<String> existIds = updateList.stream().map(TestPlanCollectionMinderEditDTO::getId).toList();
TestPlanCollectionExample example = new TestPlanCollectionExample();
example.createCriteria().andIdNotIn(existIds);
example.createCriteria().andIdNotIn(existIds).andTestPlanIdEqualTo(planId);
List<TestPlanCollection> collections = testPlanCollectionMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(collections)) {
List<String> deletedIds = collections.stream().map(TestPlanCollection::getId).toList();

View File

@ -19,7 +19,6 @@ import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -64,7 +63,7 @@ public class TestPlanExecuteService {
public static final String QUEUE_PREFIX_TEST_PLAN_COLLECTION = "test-plan-collection-execute:";
public static final String LAST_QUEUE_PREFIX = "last-queue:";
@Autowired
@Resource
private TestPlanReportMapper testPlanReportMapper;
// 停止测试计划的执行
@ -146,6 +145,8 @@ public class TestPlanExecuteService {
executionQueue.setSourceID(request.getExecuteId());
executionQueue.setRunMode(request.getRunMode());
executionQueue.setExecutionSource(request.getExecutionSource());
executionQueue.setQueueId(IDGenerator.nextStr());
executionQueue.setQueueType(QUEUE_PREFIX_TEST_PLAN_BATCH_EXECUTE);
executionQueue.setCreateUser(userId);
executionQueue.setPrepareReportId(IDGenerator.nextStr());
return executeTestPlanOrGroup(executionQueue);