fix(接口测试): 修复用例执行发送消息操作人错误问题
--bug=1010001 --user=赵勇 [接口定义]-admin创建的接口case并执行,系统通知中显示执行人不是admin https://www.tapd.cn/55049933/s/1098757
This commit is contained in:
parent
643030fa33
commit
f4bba1aca6
|
@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import io.metersphere.api.dto.RequestResultExpandDTO;
|
import io.metersphere.api.dto.RequestResultExpandDTO;
|
||||||
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult;
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.*;
|
||||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
import io.metersphere.base.mapper.*;
|
||||||
import io.metersphere.base.mapper.ApiDefinitionMapper;
|
|
||||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
|
||||||
import io.metersphere.base.mapper.TestCaseReviewApiCaseMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||||
import io.metersphere.commons.constants.*;
|
import io.metersphere.commons.constants.*;
|
||||||
import io.metersphere.commons.utils.DateUtils;
|
import io.metersphere.commons.utils.DateUtils;
|
||||||
|
@ -67,6 +64,8 @@ public class ApiDefinitionExecResultService {
|
||||||
private TestPlanTestCaseService testPlanTestCaseService;
|
private TestPlanTestCaseService testPlanTestCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
private ApiTestCaseService apiTestCaseService;
|
private ApiTestCaseService apiTestCaseService;
|
||||||
|
@Resource
|
||||||
|
private UserMapper userMapper;
|
||||||
|
|
||||||
public void saveApiResult(List<RequestResult> requestResults, ResultDTO dto) {
|
public void saveApiResult(List<RequestResult> requestResults, ResultDTO dto) {
|
||||||
boolean isFirst = true;
|
boolean isFirst = true;
|
||||||
|
@ -111,13 +110,13 @@ public class ApiDefinitionExecResultService {
|
||||||
event = NoticeConstants.Event.EXECUTE_FAILED;
|
event = NoticeConstants.Event.EXECUTE_FAILED;
|
||||||
status = "失败";
|
status = "失败";
|
||||||
}
|
}
|
||||||
|
User user = userMapper.selectByPrimaryKey(result.getUserId());
|
||||||
Map paramMap = new HashMap<>(beanMap);
|
Map paramMap = new HashMap<>(beanMap);
|
||||||
paramMap.put("operator", SessionUtils.getUser().getName());
|
paramMap.put("operator", user != null ? user.getName() : SessionUtils.getUser().getName());
|
||||||
paramMap.put("status", result.getStatus());
|
paramMap.put("status", result.getStatus());
|
||||||
String context = "${operator}执行接口用例" + status + ": ${name}";
|
String context = "${operator}执行接口用例" + status + ": ${name}";
|
||||||
NoticeModel noticeModel = NoticeModel.builder()
|
NoticeModel noticeModel = NoticeModel.builder()
|
||||||
.operator(SessionUtils.getUserId())
|
.operator(result.getUserId() != null ? result.getUserId() : SessionUtils.getUserId())
|
||||||
.context(context)
|
.context(context)
|
||||||
.subject("接口用例通知")
|
.subject("接口用例通知")
|
||||||
.successMailTemplate("api/CaseResultSuccess")
|
.successMailTemplate("api/CaseResultSuccess")
|
||||||
|
|
|
@ -1238,7 +1238,6 @@ export default {
|
||||||
}
|
}
|
||||||
this.clearResult(this.scenarioDefinition);
|
this.clearResult(this.scenarioDefinition);
|
||||||
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
|
this.clearNodeStatus(this.$refs.stepTree.root.childNodes);
|
||||||
this.sort();
|
|
||||||
this.saved = runScenario && runScenario.stepScenario ? false : true;
|
this.saved = runScenario && runScenario.stepScenario ? false : true;
|
||||||
/*触发执行操作*/
|
/*触发执行操作*/
|
||||||
this.$refs.currentScenario.validate(async (valid) => {
|
this.$refs.currentScenario.validate(async (valid) => {
|
||||||
|
|
Loading…
Reference in New Issue