feat(接口测试): 场景定时任务模版增加免登录参数
--story=1010916 --user=王孝刚 接口场景列表定时任务通知模板支持配置报告链接免登录跳转 https://www.tapd.cn/55049933/s/1322348
This commit is contained in:
parent
5da4ae7bff
commit
ab142b85c8
|
@ -30,6 +30,7 @@ import io.metersphere.log.vo.OperatingLogDetails;
|
|||
import io.metersphere.log.vo.api.ModuleReference;
|
||||
import io.metersphere.notice.sender.NoticeModel;
|
||||
import io.metersphere.notice.service.NoticeSendService;
|
||||
import io.metersphere.service.BaseShareInfoService;
|
||||
import io.metersphere.service.BaseUserService;
|
||||
import io.metersphere.service.ServiceUtils;
|
||||
import io.metersphere.service.SystemParameterService;
|
||||
|
@ -86,6 +87,8 @@ public class ApiScenarioReportService {
|
|||
private BaseUserService userService;
|
||||
@Resource
|
||||
private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
|
||||
@Resource
|
||||
BaseShareInfoService baseShareInfoService;
|
||||
|
||||
public void saveResult(ResultDTO dto) {
|
||||
// 报告详情内容
|
||||
|
@ -486,6 +489,8 @@ public class ApiScenarioReportService {
|
|||
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||
String reportUrl = baseSystemConfigDTO.getUrl() + "/#/api/automation/report/view/" + result.getId();
|
||||
paramMap.put("reportUrl", reportUrl);
|
||||
String shareUrl = getScenarioShareUrl(result.getId(), userId);
|
||||
paramMap.put("scenarioShareUrl", baseSystemConfigDTO.getUrl() + "/api/share-api-report" + shareUrl);
|
||||
String context = "${operator}执行接口自动化" + status + ": ${name}";
|
||||
NoticeModel noticeModel = NoticeModel.builder().operator(userId).context(context).subject("接口自动化通知").paramMap(paramMap).event(event).build();
|
||||
|
||||
|
@ -493,6 +498,15 @@ public class ApiScenarioReportService {
|
|||
noticeSendService.send(project, NoticeConstants.TaskType.API_AUTOMATION_TASK, noticeModel);
|
||||
}
|
||||
|
||||
public String getScenarioShareUrl(String scenarioReportId, String userId) {
|
||||
ShareInfo shareRequest = new ShareInfo();
|
||||
shareRequest.setCustomData(scenarioReportId);
|
||||
shareRequest.setShareType(ShareType.API_REPORT.name());
|
||||
shareRequest.setCreateUserId(userId);
|
||||
ShareInfo shareInfo = baseShareInfoService.generateShareInfo(shareRequest);
|
||||
return baseShareInfoService.conversionShareInfoToDTO(shareInfo).getShareUrl();
|
||||
}
|
||||
|
||||
public String update(ApiScenarioReportResult test) {
|
||||
ApiScenarioReport report = updateReport(test);
|
||||
ApiScenarioReportDetail detail = apiScenarioReportDetailMapper.selectByPrimaryKey(test.getId());
|
||||
|
|
|
@ -122,6 +122,10 @@ export default {
|
|||
label: this.$t('api_test.automation.scenario.principal'),
|
||||
value: 'principal',
|
||||
},
|
||||
{
|
||||
label: this.$t('report.plan_share_url'),
|
||||
value: 'scenarioShareUrl',
|
||||
},
|
||||
{
|
||||
label: this.$t('api_test.automation.step_total'),
|
||||
value: 'stepTotal',
|
||||
|
|
Loading…
Reference in New Issue