fix(工作台): Local平台缺陷支持查看
--bug=1049080 --user=宋昌昌 【工作台】我创建的-缺陷-点击LOCAL平台的缺陷ID查看-不展示缺陷信息 https://www.tapd.cn/55049933/s/1612335
This commit is contained in:
parent
4bba38798a
commit
72bdde0de7
|
@ -229,7 +229,7 @@ public class BugController {
|
||||||
@RequiresPermissions(PermissionConstants.PROJECT_BUG_READ)
|
@RequiresPermissions(PermissionConstants.PROJECT_BUG_READ)
|
||||||
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
|
||||||
public TemplateDTO getTemplateDetail(@RequestBody BugTemplateRequest request) {
|
public TemplateDTO getTemplateDetail(@RequestBody BugTemplateRequest request) {
|
||||||
return bugService.getTemplate(request.getId(), request.getProjectId(), request.getFromStatusId(), request.getPlatformBugKey());
|
return bugService.getTemplate(request.getId(), request.getProjectId(), request.getFromStatusId(), request.getPlatformBugKey(), request.getShowLocal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/follow/{id}")
|
@GetMapping("/follow/{id}")
|
||||||
|
|
|
@ -5,6 +5,9 @@ import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author song-cc-rock
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class BugTemplateRequest implements Serializable {
|
public class BugTemplateRequest implements Serializable {
|
||||||
|
|
||||||
|
@ -16,4 +19,6 @@ public class BugTemplateRequest implements Serializable {
|
||||||
private String fromStatusId;
|
private String fromStatusId;
|
||||||
@Schema(description = "缺陷第三方平台Key")
|
@Schema(description = "缺陷第三方平台Key")
|
||||||
private String platformBugKey;
|
private String platformBugKey;
|
||||||
|
@Schema(description = "是否展示本地的模板详情")
|
||||||
|
private Boolean showLocal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.apache.commons.collections4.ListUtils;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.ibatis.session.ExecutorType;
|
import org.apache.ibatis.session.ExecutorType;
|
||||||
import org.apache.ibatis.session.SqlSession;
|
import org.apache.ibatis.session.SqlSession;
|
||||||
|
@ -253,7 +254,7 @@ public class BugService {
|
||||||
*/
|
*/
|
||||||
public BugDetailDTO get(String id, String currentUser) {
|
public BugDetailDTO get(String id, String currentUser) {
|
||||||
Bug bug = checkBugExist(id);
|
Bug bug = checkBugExist(id);
|
||||||
TemplateDTO template = getTemplate(bug.getTemplateId(), bug.getProjectId(), null, null);
|
TemplateDTO template = getTemplate(bug.getTemplateId(), bug.getProjectId(), null, null, StringUtils.equals(bug.getPlatform(), BugPlatform.LOCAL.getName()));
|
||||||
List<BugCustomFieldDTO> allCustomFields = extBugCustomFieldMapper.getBugAllCustomFields(List.of(id), bug.getProjectId());
|
List<BugCustomFieldDTO> allCustomFields = extBugCustomFieldMapper.getBugAllCustomFields(List.of(id), bug.getProjectId());
|
||||||
BugDetailDTO detail = new BugDetailDTO();
|
BugDetailDTO detail = new BugDetailDTO();
|
||||||
detail.setId(id);
|
detail.setId(id);
|
||||||
|
@ -380,21 +381,21 @@ public class BugService {
|
||||||
* @param platformBugKey 平台缺陷key
|
* @param platformBugKey 平台缺陷key
|
||||||
* @return 模板详情
|
* @return 模板详情
|
||||||
*/
|
*/
|
||||||
public TemplateDTO getTemplate(String templateId, String projectId, String fromStatusId, String platformBugKey) {
|
public TemplateDTO getTemplate(String templateId, String projectId, String fromStatusId, String platformBugKey, Boolean showLocal) {
|
||||||
Template template = templateMapper.selectByPrimaryKey(templateId);
|
Template template = templateMapper.selectByPrimaryKey(templateId);
|
||||||
if (template != null) {
|
if (template != null) {
|
||||||
// 属于系统模板
|
// 属于系统模板
|
||||||
return injectPlatformTemplateBugField(baseTemplateService.getTemplateDTO(template), projectId, fromStatusId, platformBugKey);
|
return injectPlatformTemplateBugField(baseTemplateService.getTemplateDTO(template), projectId, fromStatusId, platformBugKey, showLocal);
|
||||||
} else {
|
} else {
|
||||||
// 不属于系统模板
|
// 不属于系统模板
|
||||||
List<ProjectTemplateOptionDTO> option = projectTemplateService.getOption(projectId, TemplateScene.BUG.name());
|
List<ProjectTemplateOptionDTO> option = projectTemplateService.getOption(projectId, TemplateScene.BUG.name());
|
||||||
Optional<ProjectTemplateOptionDTO> isThirdPartyDefaultTemplate = option.stream().filter(projectTemplateOptionDTO -> StringUtils.equals(projectTemplateOptionDTO.getId(), templateId)).findFirst();
|
Optional<ProjectTemplateOptionDTO> isThirdPartyDefaultTemplate = option.stream().filter(projectTemplateOptionDTO -> StringUtils.equals(projectTemplateOptionDTO.getId(), templateId)).findFirst();
|
||||||
if (isThirdPartyDefaultTemplate.isPresent()) {
|
if (isThirdPartyDefaultTemplate.isPresent()) {
|
||||||
// 属于第三方平台默认模板(平台生成的默认模板无需注入配置中的字段)
|
// 属于第三方平台默认模板(平台生成的默认模板无需注入配置中的字段)
|
||||||
return attachTemplateStatusField(getPluginBugDefaultTemplate(projectId, true), projectId, fromStatusId, platformBugKey);
|
return attachTemplateStatusField(getPluginBugDefaultTemplate(projectId, true), projectId, fromStatusId, platformBugKey, false);
|
||||||
} else {
|
} else {
|
||||||
// 不属于系统模板&&不属于第三方平台默认模板, 则该模板已被删除
|
// 不属于系统模板&&不属于第三方平台默认模板, 则该模板已被删除
|
||||||
return injectPlatformTemplateBugField(projectTemplateService.getDefaultTemplateDTO(projectId, TemplateScene.BUG.name()), projectId, fromStatusId, platformBugKey);
|
return injectPlatformTemplateBugField(projectTemplateService.getDefaultTemplateDTO(projectId, TemplateScene.BUG.name()), projectId, fromStatusId, platformBugKey, showLocal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -882,16 +883,16 @@ public class BugService {
|
||||||
* @param platformBugKey 平台缺陷key
|
* @param platformBugKey 平台缺陷key
|
||||||
* @return 模板
|
* @return 模板
|
||||||
*/
|
*/
|
||||||
private TemplateDTO injectPlatformTemplateBugField(TemplateDTO templateDTO, String projectId, String fromStatusId, String platformBugKey) {
|
private TemplateDTO injectPlatformTemplateBugField(TemplateDTO templateDTO, String projectId, String fromStatusId, String platformBugKey, Boolean showLocal) {
|
||||||
// 来自平台模板
|
// 来自平台模板
|
||||||
templateDTO.setPlatformDefault(false);
|
templateDTO.setPlatformDefault(false);
|
||||||
String platformName = projectApplicationService.getPlatformName(projectId);
|
String platformName = projectApplicationService.getPlatformName(projectId);
|
||||||
|
|
||||||
// 状态字段
|
// 状态字段
|
||||||
attachTemplateStatusField(templateDTO, projectId, fromStatusId, platformBugKey);
|
attachTemplateStatusField(templateDTO, projectId, fromStatusId, platformBugKey, showLocal);
|
||||||
|
|
||||||
// 内置字段(处理人字段)
|
// 内置字段(处理人字段)
|
||||||
if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) {
|
if (!StringUtils.equals(platformName, BugPlatform.LOCAL.getName()) && BooleanUtils.isFalse(showLocal)) {
|
||||||
// 获取插件中自定义的注入字段(处理人)
|
// 获取插件中自定义的注入字段(处理人)
|
||||||
ServiceIntegration serviceIntegration = projectApplicationService.getPlatformServiceIntegrationWithSyncOrDemand(projectId, true);
|
ServiceIntegration serviceIntegration = projectApplicationService.getPlatformServiceIntegrationWithSyncOrDemand(projectId, true);
|
||||||
// 状态选项获取时, 获取平台校验了服务集成配置, 所以此处不需要再次校验
|
// 状态选项获取时, 获取平台校验了服务集成配置, 所以此处不需要再次校验
|
||||||
|
@ -951,7 +952,7 @@ public class BugService {
|
||||||
* @param platformBugKey 平台缺陷key
|
* @param platformBugKey 平台缺陷key
|
||||||
* @return 模板
|
* @return 模板
|
||||||
*/
|
*/
|
||||||
public TemplateDTO attachTemplateStatusField(TemplateDTO templateDTO, String projectId, String fromStatusId, String platformBugKey) {
|
public TemplateDTO attachTemplateStatusField(TemplateDTO templateDTO, String projectId, String fromStatusId, String platformBugKey, Boolean showLocal) {
|
||||||
if (templateDTO == null) {
|
if (templateDTO == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -960,7 +961,7 @@ public class BugService {
|
||||||
statusField.setFieldName(BugTemplateCustomField.STATUS.getName());
|
statusField.setFieldName(BugTemplateCustomField.STATUS.getName());
|
||||||
statusField.setFieldKey(BugTemplateCustomField.STATUS.getId());
|
statusField.setFieldKey(BugTemplateCustomField.STATUS.getId());
|
||||||
statusField.setType(CustomFieldType.SELECT.name());
|
statusField.setType(CustomFieldType.SELECT.name());
|
||||||
List<SelectOption> statusOption = bugStatusService.getToStatusItemOption(projectId, fromStatusId, platformBugKey);
|
List<SelectOption> statusOption = bugStatusService.getToStatusItemOption(projectId, fromStatusId, platformBugKey, showLocal);
|
||||||
List<CustomFieldOption> statusCustomOption = statusOption.stream().map(option -> {
|
List<CustomFieldOption> statusCustomOption = statusOption.stream().map(option -> {
|
||||||
CustomFieldOption customFieldOption = new CustomFieldOption();
|
CustomFieldOption customFieldOption = new CustomFieldOption();
|
||||||
customFieldOption.setText(option.getText());
|
customFieldOption.setText(option.getText());
|
||||||
|
|
|
@ -12,6 +12,7 @@ import io.metersphere.sdk.util.LogUtils;
|
||||||
import io.metersphere.system.service.BaseStatusFlowSettingService;
|
import io.metersphere.system.service.BaseStatusFlowSettingService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -68,9 +69,9 @@ public class BugStatusService {
|
||||||
* @param platformBugKey 平台缺陷Key
|
* @param platformBugKey 平台缺陷Key
|
||||||
* @return 选项集合
|
* @return 选项集合
|
||||||
*/
|
*/
|
||||||
public List<SelectOption> getToStatusItemOption(String projectId, String fromStatusId, String platformBugKey) {
|
public List<SelectOption> getToStatusItemOption(String projectId, String fromStatusId, String platformBugKey, Boolean showLocal) {
|
||||||
String platformName = projectApplicationService.getPlatformName(projectId);
|
String platformName = projectApplicationService.getPlatformName(projectId);
|
||||||
if (StringUtils.equals(platformName, BugPlatform.LOCAL.getName())) {
|
if (StringUtils.equals(platformName, BugPlatform.LOCAL.getName()) || BooleanUtils.isTrue(showLocal)) {
|
||||||
// Local状态流
|
// Local状态流
|
||||||
return getToStatusItemOptionOnLocal(projectId, fromStatusId);
|
return getToStatusItemOptionOnLocal(projectId, fromStatusId);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
<a-spin :loading="loading" class="w-full">
|
<a-spin :loading="loading" class="w-full">
|
||||||
<div class="form-item-container">
|
<div class="form-item-container">
|
||||||
<!-- 所属平台一致, 详情展示 -->
|
<!-- 所属平台一致, 详情展示 -->
|
||||||
<div v-if="props.currentPlatform === detailInfo.platform" class="h-full w-full">
|
<div
|
||||||
|
v-if="detailInfo.platform === 'Local' || props.currentPlatform === detailInfo.platform"
|
||||||
|
class="h-full w-full"
|
||||||
|
>
|
||||||
<!-- 自定义字段开始 -->
|
<!-- 自定义字段开始 -->
|
||||||
<div class="inline-block w-full break-words">
|
<div class="inline-block w-full break-words">
|
||||||
<MsFormCreate
|
<MsFormCreate
|
||||||
|
@ -13,7 +16,7 @@
|
||||||
v-model:form-rule="innerFormRules"
|
v-model:form-rule="innerFormRules"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
:option="options"
|
:option="options"
|
||||||
:disabled="!hasAnyPermission(['PROJECT_BUG:READ+UPDATE'])"
|
:disabled="!hasAnyPermission(['PROJECT_BUG:READ+UPDATE']) || props.currentPlatform !== detailInfo.platform"
|
||||||
@change="handelFormCreateChange"
|
@change="handelFormCreateChange"
|
||||||
/>
|
/>
|
||||||
<!-- 自定义字段结束 -->
|
<!-- 自定义字段结束 -->
|
||||||
|
@ -32,7 +35,9 @@
|
||||||
<a-form-item field="tags" :label="t('system.orgTemplate.tags')">
|
<a-form-item field="tags" :label="t('system.orgTemplate.tags')">
|
||||||
<MsTagsInput
|
<MsTagsInput
|
||||||
v-model:model-value="innerTags"
|
v-model:model-value="innerTags"
|
||||||
:disabled="!hasAnyPermission(['PROJECT_BUG:READ+UPDATE'])"
|
:disabled="
|
||||||
|
!hasAnyPermission(['PROJECT_BUG:READ+UPDATE']) || props.currentPlatform !== detailInfo.platform
|
||||||
|
"
|
||||||
@blur="changeTag"
|
@blur="changeTag"
|
||||||
/>
|
/>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
|
@ -65,7 +70,7 @@
|
||||||
|
|
||||||
import { BugEditCustomField, BugEditFormObject, type CustomFieldItem } from '@/models/bug-management';
|
import { BugEditCustomField, BugEditFormObject, type CustomFieldItem } from '@/models/bug-management';
|
||||||
|
|
||||||
import { getCurrentText, makeCustomFieldsParams } from '../utils';
|
import { makeCustomFieldsParams } from '../utils';
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,6 @@
|
||||||
import useModal from '@/hooks/useModal';
|
import useModal from '@/hooks/useModal';
|
||||||
import { useAppStore } from '@/store';
|
import { useAppStore } from '@/store';
|
||||||
import useUserStore from '@/store/modules/user';
|
import useUserStore from '@/store/modules/user';
|
||||||
import { characterLimit } from '@/utils';
|
|
||||||
import { hasAnyPermission } from '@/utils/permission';
|
import { hasAnyPermission } from '@/utils/permission';
|
||||||
|
|
||||||
import type { CustomFieldItem } from '@/models/bug-management';
|
import type { CustomFieldItem } from '@/models/bug-management';
|
||||||
|
@ -323,6 +322,7 @@
|
||||||
id: detail.templateId,
|
id: detail.templateId,
|
||||||
fromStatusId: detail.status,
|
fromStatusId: detail.status,
|
||||||
platformBugKey: detail.platformBugId,
|
platformBugKey: detail.platformBugId,
|
||||||
|
showLocal: detail.platform === 'Local',
|
||||||
});
|
});
|
||||||
// 详情信息, TAG赋值
|
// 详情信息, TAG赋值
|
||||||
detailInfo.value = { ...detail };
|
detailInfo.value = { ...detail };
|
||||||
|
|
|
@ -1,9 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<!-- 所属平台一致, 详情展示 -->
|
<!-- 所属平台一致, 详情展示 -->
|
||||||
<div v-if="props.currentPlatform === props.detailInfo.platform" class="relative">
|
<div
|
||||||
|
v-if="props.detailInfo.platform === 'Local' || props.currentPlatform === props.detailInfo.platform"
|
||||||
|
class="relative"
|
||||||
|
>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<div v-permission="['PROJECT_BUG:READ+UPDATE']" class="header-action">
|
<div v-permission="['PROJECT_BUG:READ+UPDATE']" class="header-action">
|
||||||
<a-button type="text" @click="contentEditAble = !contentEditAble">
|
<a-button
|
||||||
|
type="text"
|
||||||
|
:disabled="props.currentPlatform !== props.detailInfo.platform"
|
||||||
|
@click="contentEditAble = !contentEditAble"
|
||||||
|
>
|
||||||
<template #icon> <MsIconfont type="icon-icon_edit_outlined" /> </template>
|
<template #icon> <MsIconfont type="icon-icon_edit_outlined" /> </template>
|
||||||
{{ t('bugManagement.edit.contentEdit') }}
|
{{ t('bugManagement.edit.contentEdit') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
|
|
Loading…
Reference in New Issue