refactor(接口测试): 接口同步功能优化

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016065
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015922
refactor(接口测试): 接口同步发消息功能优化

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015943
refactor(接口测试): 接口同步功能优化

--user=郭雨琦
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001016065
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001015922
This commit is contained in:
guoyuqi 2022-08-22 16:40:37 +08:00 committed by xiaomeinvG
parent b6048c9845
commit 22acc0a44b
2 changed files with 18 additions and 2 deletions

View File

@ -5,10 +5,12 @@ import io.metersphere.base.domain.ApiTestCase;
import io.metersphere.base.domain.ApiTestCaseWithBLOBs;
import io.metersphere.base.mapper.ApiTestCaseMapper;
import java.util.Map;
public interface ApiCaseBatchSyncService {
void oneClickSyncCase(String apiUpdateRule, ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, ApiTestCaseMapper apiTestCaseMapper, ApiTestCaseWithBLOBs testCases);
void sendApiNotice(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs);
void sendApiNotice(ApiDefinitionWithBLOBs apiDefinitionWithBLOBs, Map<String, Object> paramMap);
void sendCaseNotice(ApiTestCase apiTestCase);
}

View File

@ -421,10 +421,24 @@ public class ApiDefinitionService {
mockConfigService.updateMockReturnMsgByApi(returnModel);
FileUtils.createBodyFiles(request.getRequest().getId(), bodyFiles);
String context = SessionUtils.getUserId().concat(Translator.get("update_api")).concat(":").concat(returnModel.getName());
Map<String, Object> paramMap = new HashMap<>();
getParamMap(paramMap, returnModel.getProjectId(), SessionUtils.getUserId(), returnModel.getId(), returnModel.getName(), returnModel.getCreateUser());
paramMap.put("userId", returnModel.getUserId());
// 发送通知
if (apiCaseSyncService != null) {
apiCaseSyncService.sendApiNotice(returnModel);
apiCaseSyncService.sendApiNotice(returnModel, paramMap);
}
NoticeModel noticeModel = NoticeModel.builder()
.operator(SessionUtils.getUserId())
.context(context)
.testId(returnModel.getId())
.subject(Translator.get("api_update_notice"))
.paramMap(paramMap)
.excludeSelf(true)
.event(NoticeConstants.Event.UPDATE)
.build();
noticeSendService.send(NoticeConstants.TaskType.API_DEFINITION_TASK, noticeModel);
return getById(returnModel.getId());
}