mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 12:39:12 +08:00
fix(缺陷管理): 缺陷分享链接删除添加校验
--bug=1036436 --user=宋昌昌 【缺陷管理】分享缺陷,缺陷被删除,打开分享链接页面错误 https://www.tapd.cn/55049933/s/1476141
This commit is contained in:
parent
78d8e0d4d6
commit
f00c9080e9
@ -116,6 +116,13 @@ public class BugController {
|
||||
return bugService.addOrUpdate(request, files, SessionUtils.getUserId(), SessionUtils.getCurrentOrganizationId(), true);
|
||||
}
|
||||
|
||||
@GetMapping("/check-exist/{id}")
|
||||
@Operation(summary = "缺陷管理-列表-校验缺陷是否存在")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_BUG_READ)
|
||||
public boolean check(@PathVariable String id) {
|
||||
return bugService.checkExist(id);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
@Operation(summary = "缺陷管理-列表-查看缺陷(详情&&编辑&&复制)")
|
||||
@RequiresPermissions(PermissionConstants.PROJECT_BUG_READ)
|
||||
|
@ -567,7 +567,7 @@ public class BugAttachmentService {
|
||||
*/
|
||||
private FileLogRecord createFileLogRecord(String operator, String projectId){
|
||||
return FileLogRecord.builder()
|
||||
.logModule(OperationLogModule.BUG_MANAGEMENT)
|
||||
.logModule(OperationLogModule.BUG_MANAGEMENT_INDEX)
|
||||
.operator(operator)
|
||||
.projectId(projectId)
|
||||
.build();
|
||||
|
@ -39,7 +39,7 @@ public class BugHistoryService {
|
||||
*/
|
||||
public List<OperationHistoryDTO> list(OperationHistoryRequest request) {
|
||||
OperationHistoryExample example = new OperationHistoryExample();
|
||||
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andModuleEqualTo(OperationLogModule.BUG_MANAGEMENT)
|
||||
example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andModuleIn(List.of(OperationLogModule.BUG_MANAGEMENT_INDEX, OperationLogModule.BUG_MANAGEMENT_RECYCLE))
|
||||
.andSourceIdEqualTo(request.getSourceId());
|
||||
List<OperationHistory> history = operationHistoryMapper.selectByExample(example);
|
||||
if (CollectionUtils.isEmpty(history)) {
|
||||
|
@ -39,7 +39,7 @@ public class BugLogService {
|
||||
* @return 日志
|
||||
*/
|
||||
public LogDTO addLog(BugEditRequest request, List<MultipartFile> files) {
|
||||
LogDTO dto = new LogDTO(request.getProjectId(), null, null, null, OperationLogType.ADD.name(), OperationLogModule.BUG_MANAGEMENT, request.getTitle());
|
||||
LogDTO dto = new LogDTO(request.getProjectId(), null, null, null, OperationLogType.ADD.name(), OperationLogModule.BUG_MANAGEMENT_CREATE, request.getTitle());
|
||||
dto.setHistory(true);
|
||||
dto.setPath("/bug/add");
|
||||
dto.setMethod(HttpMethodConstants.POST.name());
|
||||
@ -56,7 +56,7 @@ public class BugLogService {
|
||||
*/
|
||||
public LogDTO updateLog(BugEditRequest request, List<MultipartFile> files) {
|
||||
BugDTO history = getOriginalValue(request.getId());
|
||||
LogDTO dto = new LogDTO(request.getProjectId(), null, request.getId(), null, OperationLogType.UPDATE.name(), OperationLogModule.BUG_MANAGEMENT, request.getTitle());
|
||||
LogDTO dto = new LogDTO(request.getProjectId(), null, request.getId(), null, OperationLogType.UPDATE.name(), OperationLogModule.BUG_MANAGEMENT_UPDATE, request.getTitle());
|
||||
dto.setHistory(true);
|
||||
dto.setPath("/bug/update");
|
||||
dto.setMethod(HttpMethodConstants.POST.name());
|
||||
@ -74,7 +74,7 @@ public class BugLogService {
|
||||
public LogDTO deleteLog(String id) {
|
||||
Bug bug = bugMapper.selectByPrimaryKey(id);
|
||||
if (bug != null) {
|
||||
LogDTO dto = new LogDTO(bug.getProjectId(), null, bug.getId(), null, OperationLogType.DELETE.name(), OperationLogModule.BUG_MANAGEMENT, bug.getTitle());
|
||||
LogDTO dto = new LogDTO(bug.getProjectId(), null, bug.getId(), null, OperationLogType.DELETE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, bug.getTitle());
|
||||
dto.setPath("/bug/delete");
|
||||
dto.setMethod(HttpMethodConstants.GET.name());
|
||||
dto.setOriginalValue(JSON.toJSONBytes(bug));
|
||||
@ -92,7 +92,7 @@ public class BugLogService {
|
||||
public LogDTO recoverLog(String id) {
|
||||
Bug bug = bugMapper.selectByPrimaryKey(id);
|
||||
if (bug != null) {
|
||||
LogDTO dto = new LogDTO(bug.getProjectId(), null, bug.getId(), null, OperationLogType.RECOVER.name(), OperationLogModule.BUG_MANAGEMENT, bug.getTitle());
|
||||
LogDTO dto = new LogDTO(bug.getProjectId(), null, bug.getId(), null, OperationLogType.RECOVER.name(), OperationLogModule.BUG_MANAGEMENT_RECYCLE, bug.getTitle());
|
||||
dto.setPath("/bug/trash/recover");
|
||||
dto.setMethod(HttpMethodConstants.GET.name());
|
||||
dto.setOriginalValue(JSON.toJSONBytes(bug));
|
||||
|
@ -85,6 +85,9 @@ public class BugNoticeService {
|
||||
public BugNoticeDTO getNoticeById(String id) {
|
||||
// 缺陷基础信息
|
||||
BugDTO bugDTO = bugLogService.getOriginalValue(id);
|
||||
if (bugDTO == null) {
|
||||
return null;
|
||||
}
|
||||
// 构建通知对象
|
||||
BugNoticeDTO notice = new BugNoticeDTO();
|
||||
BeanUtils.copyBean(notice, bugDTO);
|
||||
|
@ -31,7 +31,7 @@ public class BugRelateCaseLogService {
|
||||
public LogDTO getRelateLog(String id) {
|
||||
BugRelationCase bugRelationCase = bugRelationCaseMapper.selectByPrimaryKey(id);
|
||||
BugRelateCaseDTO relateCase = extBugRelateCaseMapper.getRelateCase(bugRelationCase.getCaseId(), bugRelationCase.getCaseType());
|
||||
LogDTO dto = new LogDTO(relateCase.getProjectId(), null, null, null, OperationLogType.DISASSOCIATE.name(), OperationLogModule.BUG_MANAGEMENT, relateCase.getRelateCaseName());
|
||||
LogDTO dto = new LogDTO(relateCase.getProjectId(), null, null, null, OperationLogType.DISASSOCIATE.name(), OperationLogModule.BUG_MANAGEMENT_INDEX, relateCase.getRelateCaseName());
|
||||
dto.setPath("/bug/un-relate");
|
||||
dto.setMethod(HttpMethodConstants.GET.name());
|
||||
dto.setModifiedValue(JSON.toJSONBytes(relateCase));
|
||||
|
@ -843,6 +843,17 @@ public class BugService {
|
||||
return bugs.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验缺陷是否存在并返回
|
||||
* @param id 缺陷ID
|
||||
* @return 缺陷
|
||||
*/
|
||||
public boolean checkExist(String id) {
|
||||
BugExample bugExample = new BugExample();
|
||||
bugExample.createCriteria().andIdEqualTo(id).andDeletedEqualTo(false);
|
||||
return bugMapper.countByExample(bugExample) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理保存自定义字段信息
|
||||
*
|
||||
@ -1322,7 +1333,7 @@ public class BugService {
|
||||
*/
|
||||
private FileLogRecord createFileLogRecord(String operator, String projectId){
|
||||
return FileLogRecord.builder()
|
||||
.logModule(OperationLogModule.BUG_MANAGEMENT)
|
||||
.logModule(OperationLogModule.BUG_MANAGEMENT_INDEX)
|
||||
.operator(operator)
|
||||
.projectId(projectId)
|
||||
.build();
|
||||
@ -1511,7 +1522,7 @@ public class BugService {
|
||||
List<Bug> bugs = bugMapper.selectByExample(example);
|
||||
List<LogDTO> logs = new ArrayList<>();
|
||||
bugs.forEach(bug -> {
|
||||
LogDTO log = new LogDTO(bug.getProjectId(), project.getOrganizationId(), bug.getId(), null, operationType, OperationLogModule.BUG_MANAGEMENT, bug.getTitle());
|
||||
LogDTO log = new LogDTO(bug.getProjectId(), project.getOrganizationId(), bug.getId(), null, operationType, OperationLogModule.BUG_MANAGEMENT_INDEX, bug.getTitle());
|
||||
log.setPath(path);
|
||||
log.setMethod(HttpMethodConstants.POST.name());
|
||||
if (batchUpdate) {
|
||||
|
@ -91,6 +91,7 @@ public class BugControllerTests extends BaseTest {
|
||||
public static final String BUG_EXPORT_COLUMNS = "/bug/export/columns/%s";
|
||||
public static final String BUG_EXPORT = "/bug/export";
|
||||
public static final String BUG_CURRENT_PLATFORM = "/bug/current-platform/%s";
|
||||
public static final String BUG_EXIST_CHECK = "/bug/check-exist/%s";
|
||||
|
||||
@Resource
|
||||
private PluginService pluginService;
|
||||
@ -474,6 +475,12 @@ public class BugControllerTests extends BaseTest {
|
||||
this.requestGetWithOk(String.format(BUG_CURRENT_PLATFORM, "default-project-for-bug"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(16)
|
||||
void testCheckBugExist() throws Exception {
|
||||
this.requestGetWithOk(String.format(BUG_EXIST_CHECK, "default-project-for-bug-not-exist"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(90)
|
||||
void testDeleteBugSuccess() throws Exception {
|
||||
|
@ -6,5 +6,5 @@ INSERT INTO bug (id, num, title, handle_users, handle_user, create_user, create_
|
||||
('bug-history-id', 100000, 'default-bug', 'oasis', 'oasis', 'admin', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, 'admin', UNIX_TIMESTAMP() * 1000, '100001100001', 'bug-template-id', 'Local', 'open', null, null, 1, 5000);
|
||||
|
||||
INSERT INTO operation_history (`id`, `project_id`, `create_time`, `create_user`, `source_id`, `type`, `module`, `ref_id`) VALUES
|
||||
(1, '100001100001', 1706079964322, 'admin', 'bug-history-id', 'ADD', 'BUG_MANAGEMENT', NULL),
|
||||
(2, '100001100001', 1706079964322, 'admin', 'bug-history-id', 'ADD', 'BUG_MANAGEMENT', NULL);
|
||||
(1, '100001100001', 1706079964322, 'admin', 'bug-history-id', 'ADD', 'BUG_MANAGEMENT_INDEX', NULL),
|
||||
(2, '100001100001', 1706079964322, 'admin', 'bug-history-id', 'ADD', 'BUG_MANAGEMENT_RECYCLE', NULL);
|
@ -143,7 +143,10 @@ public class OperationLogModule {
|
||||
//接口管理-环境
|
||||
public static final String API_DEFINITION_ENVIRONMENT = "API_DEFINITION_ENVIRONMENT";
|
||||
// 缺陷管理
|
||||
public static final String BUG_MANAGEMENT = "BUG_MANAGEMENT";
|
||||
public static final String BUG_MANAGEMENT_INDEX = "BUG_MANAGEMENT_BUG_INDEX";
|
||||
public static final String BUG_MANAGEMENT_RECYCLE = "BUG_MANAGEMENT_BUG_RECYCLE";
|
||||
public static final String BUG_MANAGEMENT_CREATE = "BUG_MANAGEMENT_BUG_INDEX_CREATE";
|
||||
public static final String BUG_MANAGEMENT_UPDATE = "BUG_MANAGEMENT_BUG_INDEX_UPDATE";
|
||||
//测试计划
|
||||
public static final String TEST_PLAN = "TEST_PLAN";
|
||||
public static final String TEST_PLAN_MODULE = "TEST_PLAN_MODULE";
|
||||
|
@ -7,6 +7,14 @@ import { BugEditFormObject, BugListItem, BugOptionListItem } from '@/models/bug-
|
||||
import { AssociatedList, DemandItem, OperationFile } from '@/models/caseManagement/featureCase';
|
||||
import { CommonList, TableQueryParams, TemplateOption } from '@/models/common';
|
||||
|
||||
/**
|
||||
* 校验缺陷是否存在
|
||||
*
|
||||
*/
|
||||
export function checkBugExist(id: string) {
|
||||
return MSR.get({ url: `${bugURL.checkBugExist}${id}` });
|
||||
}
|
||||
|
||||
/**
|
||||
* 表格的查询
|
||||
* @param data
|
||||
|
@ -1,4 +1,5 @@
|
||||
export const getPlatform = '/bug/current-platform/';
|
||||
export const checkBugExist = '/bug/check-exist/';
|
||||
export const postTableListUrl = '/bug/page';
|
||||
export const postUpdateBugUrl = '/bug/update';
|
||||
export const postBatchUpdateBugUrl = '/bug/batch-update';
|
||||
|
@ -230,6 +230,7 @@
|
||||
import TableFilter from '@/views/case-management/caseManagementFeature/components/tableFilter.vue';
|
||||
|
||||
import {
|
||||
checkBugExist,
|
||||
deleteBatchBug,
|
||||
deleteSingleBug,
|
||||
exportBug,
|
||||
@ -647,10 +648,27 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleShowDetail = (id: string, rowIndex: number) => {
|
||||
detailVisible.value = true;
|
||||
activeDetailId.value = id;
|
||||
activeCaseIndex.value = rowIndex;
|
||||
const checkBug = async (id: string) => {
|
||||
const res = await checkBugExist(id);
|
||||
return res;
|
||||
};
|
||||
|
||||
const handleShowDetail = async (id: string, rowIndex: number) => {
|
||||
const exist = await checkBug(id);
|
||||
if (!exist) {
|
||||
// 缺陷不存在, 不展示详情
|
||||
Message.error(t('bugManagement.detail.notExist'));
|
||||
const query = { ...route.query };
|
||||
delete query.id;
|
||||
await router.push({
|
||||
name: RouteEnum.BUG_MANAGEMENT_INDEX,
|
||||
query,
|
||||
});
|
||||
} else {
|
||||
detailVisible.value = true;
|
||||
activeDetailId.value = id;
|
||||
activeCaseIndex.value = rowIndex;
|
||||
}
|
||||
};
|
||||
|
||||
const handleCopy = (record: BugListItem) => {
|
||||
@ -728,7 +746,6 @@
|
||||
const setCurrentPlatform = async () => {
|
||||
const res = await getPlatform(projectId.value);
|
||||
currentPlatform.value = res;
|
||||
console.log(currentPlatform.value);
|
||||
};
|
||||
|
||||
const moreActionList: ActionsItem[] = [
|
||||
|
@ -57,6 +57,7 @@ export default {
|
||||
cannotBeNull: 'is empty',
|
||||
},
|
||||
detail: {
|
||||
notExist: 'Bug not exist',
|
||||
title: '【{id}】{name}',
|
||||
apiCase: 'API Case',
|
||||
scenarioCase: 'Scenario Case',
|
||||
|
@ -57,6 +57,7 @@ export default {
|
||||
cannotBeNull: '不能为空',
|
||||
},
|
||||
detail: {
|
||||
notExist: '缺陷不存在',
|
||||
title: '【{id}】{name}',
|
||||
apiCase: '接口用例',
|
||||
scenarioCase: '场景用例',
|
||||
|
@ -80,6 +80,7 @@
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useUserStore from '@/store/modules/user/index';
|
||||
import { openWindow } from '@/utils/index';
|
||||
import { hasAnyPermission } from '@/utils/permission';
|
||||
|
||||
import type { SkipTitle, StepListType } from '@/models/setting/serviceIntegration';
|
||||
import { SettingRouteEnum } from '@/enums/routeEnum';
|
||||
@ -87,7 +88,7 @@
|
||||
const userStore = useUserStore();
|
||||
|
||||
const isHasSystemPermission = computed(() => {
|
||||
return userStore.isAdmin;
|
||||
return hasAnyPermission(['SYSTEM_PLUGIN:READ']);
|
||||
});
|
||||
|
||||
const { t } = useI18n();
|
||||
|
Loading…
Reference in New Issue
Block a user