fix(项目设置): 更改性能设置审核人的通知方式,如果不指定人则默认发送给创建人
--bug=1026389 --user=宋天阳 【接口测试】审核通知的 首字 信息是 “环境/用例”的名称首字 https://www.tapd.cn/55049933/s/1373784;--bug=1026395 --user=宋天阳 【项目设置】应用管理-性能测试-项目添加成员后审核人下拉显示无添加的成员 https://www.tapd.cn/55049933/s/1373801;
This commit is contained in:
parent
fac705d4a1
commit
c0c8ba5aab
|
@ -51,18 +51,27 @@
|
|||
>
|
||||
<el-col :span="2">
|
||||
<div class="icon-title">
|
||||
{{ row.resourceName.substring(0, 1) }}
|
||||
{{ $t("commons.system_notification_logo") }}
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="22">
|
||||
<span class="operation">
|
||||
<span>{{ getResource(row) }}:</span>
|
||||
<span
|
||||
@click="clickResource(row)"
|
||||
style="color: #783887; cursor: pointer"
|
||||
>
|
||||
{{ row.resourceName }}
|
||||
</span>
|
||||
|
||||
<el-popover
|
||||
placement="top-start"
|
||||
width="200"
|
||||
trigger="hover"
|
||||
:content="row.resourceName">
|
||||
<span slot="reference"
|
||||
@click="clickResource(row)"
|
||||
style="color: #783887; cursor: pointer"
|
||||
>
|
||||
{{ getShortResourceName(row.resourceName) }}
|
||||
</span>
|
||||
</el-popover>
|
||||
|
||||
|
||||
<span> {{ $t("commons.contains_script_review") }} </span>
|
||||
</span>
|
||||
</el-col>
|
||||
|
@ -107,11 +116,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getOperation, getResource, getUrl } from "../util";
|
||||
import {
|
||||
searchNotifications,
|
||||
updateUserByResourceId,
|
||||
} from "../../../api/notification";
|
||||
import {getOperation, getResource, getUrl} from "../util";
|
||||
import {searchNotifications, updateUserByResourceId,} from "../../../api/notification";
|
||||
|
||||
export default {
|
||||
name: "NotificationData",
|
||||
|
@ -184,6 +190,9 @@ export default {
|
|||
this.toPage(uri);
|
||||
});
|
||||
},
|
||||
getShortResourceName(resourceName) {
|
||||
return resourceName.length > 7 ? resourceName.substring(0, 7) + "..." : resourceName;
|
||||
},
|
||||
toPage(uri) {
|
||||
let id = "new_a";
|
||||
let a = document.createElement("a");
|
||||
|
|
|
@ -28,6 +28,7 @@ const message = {
|
|||
xmindFile: "Xmind",
|
||||
default: "default",
|
||||
sort_default: "Default",
|
||||
system_notification_logo: "Sys",
|
||||
please_select_import_mode: "Please select import mode",
|
||||
please_select_import_module: "Please select import module",
|
||||
pass_rate: "Pass Rate",
|
||||
|
|
|
@ -28,6 +28,7 @@ const message = {
|
|||
xmindFile: "思维导图.xmind",
|
||||
default: "默认值",
|
||||
sort_default: "默认排序",
|
||||
system_notification_logo: "系",
|
||||
please_select_import_mode: "请选择导入模式",
|
||||
please_select_import_module: "请选择导入模块",
|
||||
pass_rate: "通过率",
|
||||
|
|
|
@ -28,6 +28,7 @@ const message = {
|
|||
xmindFile: "思維導圖.xmind",
|
||||
default: "默認值",
|
||||
sort_default: "默認排序",
|
||||
system_notification_logo: "系",
|
||||
please_select_import_mode: "請選擇導入模式",
|
||||
please_select_import_module: "請選擇導入模塊",
|
||||
pass_rate: "通過率",
|
||||
|
|
|
@ -102,7 +102,7 @@ public class PerformanceTestController {
|
|||
List<ApiLoadTest> apiList = request.getApiList();
|
||||
apiPerformanceService.add(apiList, loadTest.getId());
|
||||
//检查并发送审核脚本的通知
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, request.getId(), request.getName(), request.getProjectId());
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, loadTest);
|
||||
return loadTest;
|
||||
}
|
||||
|
||||
|
@ -115,10 +115,10 @@ public class PerformanceTestController {
|
|||
@RequestPart("request") EditTestPlanRequest request,
|
||||
@RequestPart(value = "file", required = false) List<MultipartFile> files
|
||||
) {
|
||||
LoadTest returnModel = performanceTestService.edit(request, files);
|
||||
LoadTest loadTest = performanceTestService.edit(request, files);
|
||||
//检查并发送审核脚本的通知
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, request.getId(), request.getName(), request.getProjectId());
|
||||
return returnModel;
|
||||
performanceTestService.checkAndSendReviewMessage(new ArrayList<>(request.getUpdatedFileList()), files, loadTest);
|
||||
return loadTest;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1004,31 +1004,42 @@ public class PerformanceTestService {
|
|||
return extLoadTestMapper.selectBaseCaseByProjectId(projectId);
|
||||
}
|
||||
|
||||
private boolean checkLoadTest(LoadTest loadTest) {
|
||||
return loadTest != null && StringUtils.isNoneBlank(loadTest.getId(), loadTest.getName(), loadTest.getProjectId(), loadTest.getCreateUser());
|
||||
}
|
||||
|
||||
//检查并发送脚本审核的通知
|
||||
public void checkAndSendReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files, String loadTestId, String loadTestName, String projectId) {
|
||||
ProjectApplication reviewLoadTestScript = baseProjectApplicationService.getProjectApplication(
|
||||
projectId, ProjectApplicationType.PERFORMANCE_REVIEW_LOAD_TEST_SCRIPT.name());
|
||||
if (BooleanUtils.toBoolean(reviewLoadTestScript.getTypeValue())) {
|
||||
ProjectApplication loadTestScriptReviewerConfig = baseProjectApplicationService.getProjectApplication(
|
||||
projectId, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name());
|
||||
if (StringUtils.isNotEmpty(loadTestScriptReviewerConfig.getTypeValue()) && baseProjectService.isProjectMember(projectId, loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
public void checkAndSendReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files, LoadTest loadTest) {
|
||||
if (checkLoadTest(loadTest)) {
|
||||
String projectId = loadTest.getProjectId();
|
||||
ProjectApplication reviewLoadTestScript = baseProjectApplicationService.getProjectApplication(
|
||||
projectId, ProjectApplicationType.PERFORMANCE_REVIEW_LOAD_TEST_SCRIPT.name());
|
||||
if (BooleanUtils.toBoolean(reviewLoadTestScript.getTypeValue())) {
|
||||
boolean isSend = this.isSendScriptReviewMessage(fileMetadataList, files);
|
||||
if (isSend) {
|
||||
Notification notification = new Notification();
|
||||
notification.setTitle("性能测试通知");
|
||||
notification.setOperator(SessionUtils.getUserId());
|
||||
notification.setOperation(NoticeConstants.Event.REVIEW);
|
||||
notification.setResourceId(loadTestId);
|
||||
notification.setResourceName(loadTestName);
|
||||
notification.setResourceType(NoticeConstants.TaskType.PERFORMANCE_TEST_TASK);
|
||||
notification.setType(NotificationConstants.Type.SYSTEM_NOTICE.name());
|
||||
notification.setStatus(NotificationConstants.Status.UNREAD.name());
|
||||
notification.setCreateTime(System.currentTimeMillis());
|
||||
notification.setReceiver(loadTestScriptReviewerConfig.getTypeValue());
|
||||
notificationService.sendAnnouncement(notification);
|
||||
String sendUser = loadTest.getCreateUser();
|
||||
ProjectApplication loadTestScriptReviewerConfig = baseProjectApplicationService.getProjectApplication(projectId, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name());
|
||||
if (StringUtils.isNotEmpty(loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
sendUser = loadTestScriptReviewerConfig.getTypeValue();
|
||||
}
|
||||
if (baseProjectService.isProjectMember(projectId, loadTestScriptReviewerConfig.getTypeValue())) {
|
||||
Notification notification = new Notification();
|
||||
notification.setTitle("性能测试通知");
|
||||
notification.setOperator(SessionUtils.getUserId());
|
||||
notification.setOperation(NoticeConstants.Event.REVIEW);
|
||||
notification.setResourceId(loadTest.getId());
|
||||
notification.setResourceName(loadTest.getName());
|
||||
notification.setResourceType(NoticeConstants.TaskType.PERFORMANCE_TEST_TASK);
|
||||
notification.setType(NotificationConstants.Type.SYSTEM_NOTICE.name());
|
||||
notification.setStatus(NotificationConstants.Status.UNREAD.name());
|
||||
notification.setCreateTime(System.currentTimeMillis());
|
||||
notification.setReceiver(sendUser);
|
||||
notificationService.sendAnnouncement(notification);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isSendScriptReviewMessage(List<FileMetadata> fileMetadataList, List<MultipartFile> files) {
|
||||
|
|
|
@ -257,7 +257,9 @@ public class ProjectApplicationService {
|
|||
String projectId = conf.getProjectId();
|
||||
String type = conf.getType();
|
||||
String value = conf.getTypeValue();
|
||||
if (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value)) {
|
||||
//性能测试审核人,允许value值为空
|
||||
if (!StringUtils.equals(type, ProjectApplicationType.PERFORMANCE_SCRIPT_REVIEWER.name())
|
||||
&& (StringUtils.isBlank(projectId) || StringUtils.isBlank(type) || StringUtils.isEmpty(value))) {
|
||||
LogUtil.error("create or update project config error. project id or conf type or value is blank.");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -406,6 +406,7 @@
|
|||
:reviewers="userInProject"
|
||||
:reviewer.sync="config.performanceScriptReviewer"
|
||||
:reviewerSwitch.sync="config.performanceReviewLoadTestScript"
|
||||
:placeholder="$t('commons.creator')"
|
||||
@reviewerChange="
|
||||
switchChange(
|
||||
'PERFORMANCE_SCRIPT_REVIEWER',
|
||||
|
@ -712,10 +713,12 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.init();
|
||||
this.selectUserInProject();
|
||||
this.getResourcePools();
|
||||
this.isXpack = !!hasLicense();
|
||||
},
|
||||
activated() {
|
||||
this.selectUserInProject();
|
||||
},
|
||||
computed: {
|
||||
projectId() {
|
||||
return getCurrentProjectID();
|
||||
|
@ -725,7 +728,7 @@ export default {
|
|||
getResourcePools() {
|
||||
this.result = getTestResourcePools().then((response) => {
|
||||
this.resourcePools = response.data;
|
||||
let delIndex = this.resourcePools.findIndex(item =>
|
||||
let delIndex = this.resourcePools.findIndex(item =>
|
||||
item.id === this.config.resourcePoolId);
|
||||
if (delIndex === -1) {
|
||||
this.config.resourcePoolId = undefined;
|
||||
|
|
|
@ -21,12 +21,13 @@
|
|||
<template #middle>
|
||||
<span>{{ $t("pj.reviewers") }}</span>
|
||||
<el-select
|
||||
clearable
|
||||
v-model="reviewerSelect"
|
||||
@change="reviewerChange"
|
||||
size="mini"
|
||||
style="margin-left: 5px"
|
||||
filterable
|
||||
:placeholder="$t('api_test.definition.api_principal')"
|
||||
:placeholder="placeholder"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in reviewers"
|
||||
|
@ -39,7 +40,6 @@
|
|||
</template>
|
||||
<template #append>
|
||||
<el-switch
|
||||
:disabled="!reviewerSelect || reviewerSelect===''"
|
||||
v-model="reviewerSwitchSelect"
|
||||
@change="switchChange"
|
||||
></el-switch>
|
||||
|
@ -59,6 +59,12 @@ export default {
|
|||
reviewers: Array,
|
||||
reviewer: String,
|
||||
reviewerSwitch: Boolean,
|
||||
placeholder: {
|
||||
type: String,
|
||||
default() {
|
||||
return this.$t('api_test.definition.api_principal');
|
||||
}
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
return {};
|
||||
|
|
|
@ -916,9 +916,13 @@ public class TestPlanReportService {
|
|||
if (CollectionUtils.isNotEmpty(testPlanReportIdList)) {
|
||||
List<String> scenarioReportIds = extTestPlanReportContentMapper.selectUiReportByTestPlanReportIds(testPlanReportIdList);
|
||||
if (CollectionUtils.isNotEmpty(scenarioReportIds)) {
|
||||
extTestPlanReportContentMapper.deleteUiReportByIds(scenarioReportIds);
|
||||
extTestPlanReportContentMapper.deleteUiReportResultByIds(scenarioReportIds);
|
||||
extTestPlanReportContentMapper.deleteUiReportStructureByIds(scenarioReportIds);
|
||||
try {
|
||||
extTestPlanReportContentMapper.deleteUiReportByIds(scenarioReportIds);
|
||||
extTestPlanReportContentMapper.deleteUiReportResultByIds(scenarioReportIds);
|
||||
extTestPlanReportContentMapper.deleteUiReportStructureByIds(scenarioReportIds);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("删除UI报告出错!", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue