fix(项目管理): 修复Git文件引入其他分支文件时提示文件已存在的bug,并在表格展示git文件时增加分支显示
--bug=1025343 --user=宋天阳 [项目管理] github#23586git文件上传不同分支,同一路径文件拉取失败报文件已存在 https://www.tapd.cn/55049933/s/1362041
This commit is contained in:
parent
944c9e120e
commit
085e069cb7
|
@ -97,17 +97,26 @@ public class FileMetadataService {
|
|||
return result;
|
||||
}
|
||||
|
||||
private void validateGitFile(FileMetadataCreateRequest fileMetadata) {
|
||||
if (StringUtils.isEmpty(fileMetadata.getModuleId())) {
|
||||
private void validateGitFile(FileMetadataCreateRequest validateModel) {
|
||||
if (StringUtils.isEmpty(validateModel.getModuleId())) {
|
||||
MSException.throwException(Translator.get("test_case_module_not_null"));
|
||||
} else {
|
||||
FileMetadataExample example = new FileMetadataExample();
|
||||
example.createCriteria().andModuleIdEqualTo(fileMetadata.getModuleId())
|
||||
.andStorageEqualTo(fileMetadata.getStorage())
|
||||
.andPathEqualTo(fileMetadata.getRepositoryPath())
|
||||
.andIdNotEqualTo(fileMetadata.getId());
|
||||
if (fileMetadataMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("project_file_already_exists"));
|
||||
example.createCriteria().andModuleIdEqualTo(validateModel.getModuleId())
|
||||
.andStorageEqualTo(validateModel.getStorage())
|
||||
.andPathEqualTo(validateModel.getRepositoryPath())
|
||||
.andIdNotEqualTo(validateModel.getId());
|
||||
List<FileMetadataWithBLOBs> fileMetadataWithBLOBsList = fileMetadataMapper.selectByExampleWithBLOBs(example);
|
||||
for (FileMetadataWithBLOBs fileMetadataWithBlobs : fileMetadataWithBLOBsList) {
|
||||
RemoteFileAttachInfo gitFileInfo = null;
|
||||
try {
|
||||
gitFileInfo = JSON.parseObject(fileMetadataWithBlobs.getAttachInfo(), RemoteFileAttachInfo.class);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("解析git信息失败!", e);
|
||||
}
|
||||
if (StringUtils.equals(gitFileInfo.getBranch(), validateModel.getRepositoryBranch())) {
|
||||
MSException.throwException(Translator.get("project_file_already_exists"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,21 @@
|
|||
:min-width="120"
|
||||
:label="$t('load_test.file_name')"
|
||||
>
|
||||
<template v-slot="scope">
|
||||
<span v-if="scope.row.storage !== 'GIT'">
|
||||
{{ scope.row.name }}
|
||||
</span>
|
||||
<div v-else>
|
||||
<span>
|
||||
{{ scope.row.name }}
|
||||
</span>
|
||||
<ms-tag
|
||||
effect="plain"
|
||||
class="ms-tags"
|
||||
:content="parseGitBranch(scope.row.attachInfo)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</ms-table-column>
|
||||
<ms-table-column
|
||||
sortable
|
||||
|
@ -425,6 +440,11 @@ export default {
|
|||
downloadMetaData(row.id, name);
|
||||
// this.$fileDownload("/file/metadata/download/" + row.id, name);
|
||||
},
|
||||
parseGitBranch(attachInfo) {
|
||||
let branch = "master";
|
||||
branch = JSON.parse(attachInfo)["branch"];
|
||||
return branch;
|
||||
},
|
||||
exportZip() {
|
||||
let array = [];
|
||||
this.$refs.table.selectRows.forEach((item) => {
|
||||
|
|
Loading…
Reference in New Issue