fix(接口场景,接口自动化): 修复垃圾站的旧数据无法恢复的问题 (#5071)
--bug=1005429 --user=宋天阳 【github#4993】场景回收站无法批量恢复 https://www.tapd.cn/55049933/s/1029410 Co-authored-by: song-tianyang <tianyang.song@fit2cloud.com>
This commit is contained in:
parent
6b65765d01
commit
85d0b78801
|
@ -570,7 +570,20 @@ public class ApiAutomationService {
|
|||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
List<ApiScenario> scenarioList = apiScenarioMapper.selectByExample(example);
|
||||
Map<String,List<ApiScenario>> nodeMap = scenarioList.stream().collect(Collectors.groupingBy(ApiScenario :: getApiScenarioModuleId));
|
||||
Map<String,List<ApiScenario>> nodeMap = new HashMap<>();
|
||||
for (ApiScenario api:scenarioList) {
|
||||
String moduleId = api.getApiScenarioModuleId();
|
||||
if(StringUtils.isEmpty(moduleId)){
|
||||
moduleId = "";
|
||||
}
|
||||
if(nodeMap.containsKey(moduleId)){
|
||||
nodeMap.get(moduleId).add(api);
|
||||
}else {
|
||||
List<ApiScenario> list = new ArrayList<>();
|
||||
list.add(api);
|
||||
nodeMap.put(moduleId,list);
|
||||
}
|
||||
}
|
||||
ApiScenarioModuleService apiScenarioModuleService = CommonBeanFactory.getBean(ApiScenarioModuleService.class);
|
||||
for(Map.Entry<String,List<ApiScenario>> entry : nodeMap.entrySet()){
|
||||
String nodeId = entry.getKey();
|
||||
|
|
|
@ -241,7 +241,21 @@ public class ApiDefinitionService {
|
|||
ApiDefinitionExample example = new ApiDefinitionExample();
|
||||
example.createCriteria().andIdIn(request.getIds());
|
||||
List<ApiDefinition> reductionCaseList = apiDefinitionMapper.selectByExample(example);
|
||||
Map<String, List<ApiDefinition>> nodeMap = reductionCaseList.stream().collect(Collectors.groupingBy(ApiDefinition::getModuleId));
|
||||
Map<String,List<ApiDefinition>> nodeMap = new HashMap<>();
|
||||
for (ApiDefinition api:reductionCaseList) {
|
||||
String moduleId = api.getModuleId();
|
||||
if(StringUtils.isEmpty(moduleId)){
|
||||
moduleId = "";
|
||||
}
|
||||
if(nodeMap.containsKey(moduleId)){
|
||||
nodeMap.get(moduleId).add(api);
|
||||
}else {
|
||||
List<ApiDefinition> list = new ArrayList<>();
|
||||
list.add(api);
|
||||
nodeMap.put(moduleId,list);
|
||||
}
|
||||
}
|
||||
// Map<String,List<ApiDefinition>> nodeMap = reductionCaseList.stream().collect(Collectors.groupingBy(ApiDefinition :: getModuleId));
|
||||
ApiModuleService apiModuleService = CommonBeanFactory.getBean(ApiModuleService.class);
|
||||
for(Map.Entry<String,List<ApiDefinition>> entry : nodeMap.entrySet()){
|
||||
String nodeId = entry.getKey();
|
||||
|
@ -855,10 +869,6 @@ public class ApiDefinitionService {
|
|||
BeanUtils.copyBean(definitionWithBLOBs, request);
|
||||
definitionWithBLOBs.setUpdateTime(System.currentTimeMillis());
|
||||
apiDefinitionMapper.updateByExampleSelective(definitionWithBLOBs, getBatchExample(request));
|
||||
|
||||
// 同步修改用例
|
||||
apiTestCaseService.updateByApiDefinitionId(request.getIds(), request.getPath(), request.getMethod(), request.getProtocol());
|
||||
|
||||
}
|
||||
|
||||
public void testPlanRelevance(ApiCaseRelevanceRequest request) {
|
||||
|
@ -1051,7 +1061,6 @@ public class ApiDefinitionService {
|
|||
|
||||
/**
|
||||
* 列表开关切换
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
public void switchSchedule(Schedule request) {
|
||||
|
|
Loading…
Reference in New Issue