fix(测试跟踪): 关联附件未记录日志问题及左侧模块树拖动问题
--bug=1024041 --user=宋昌昌 【测试跟踪】变更记录,关联附件操作,没有变更记录 https://www.tapd.cn/55049933/s/1346960
This commit is contained in:
parent
04372f4848
commit
d1ec4175e7
|
@ -38,7 +38,7 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
||||||
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? showBySubStr(getLocalDefaultName()) : showBySubStr(data.name)" :case-num="getCaseNum(data)"/>
|
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? getLocalDefaultName() : data.name" :case-num="getCaseNum(data)"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
<span v-if="!disabled" class="node-operate child">
|
<span v-if="!disabled" class="node-operate child">
|
||||||
|
@ -128,7 +128,7 @@
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
<el-tooltip class="item" effect="dark" :content="data.name" placement="top-start" :open-delay="1000">
|
||||||
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? showBySubStr(getLocalDefaultName()) : showBySubStr(data.name)" :case-num="getCaseNum(data)"/>
|
<span v-if="!data.isEdit" class="node-title" v-text="isDefault(data) ? getLocalDefaultName() : data.name" :case-num="getCaseNum(data)"/>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
|
|
||||||
|
|
||||||
|
@ -193,7 +193,6 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import MsLeft2RightContainer from "../MsLeft2RightContainer";
|
import MsLeft2RightContainer from "../MsLeft2RightContainer";
|
||||||
import { Message } from 'element-ui';
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "MsNodeTree",
|
name: "MsNodeTree",
|
||||||
|
@ -652,13 +651,6 @@ export default {
|
||||||
return this.$t('commons.module_title');
|
return this.$t('commons.module_title');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
showBySubStr(text) {
|
|
||||||
if (text.toString().length > 7) {
|
|
||||||
return text.toString().substring(0, 7) + "...";
|
|
||||||
} else {
|
|
||||||
return text.toString();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
getCaseNum(data) {
|
getCaseNum(data) {
|
||||||
if (this.showCaseNum && data.caseNum) {
|
if (this.showCaseNum && data.caseNum) {
|
||||||
return " (" + data.caseNum + ")";
|
return " (" + data.caseNum + ")";
|
||||||
|
@ -712,11 +704,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
.node-title {
|
.node-title {
|
||||||
width: 0px;
|
width: 0;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
padding: 0px 9px;
|
padding: 0 9px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: 'PingFang SC';
|
font-family: 'PingFang SC';
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
|
@ -744,7 +736,7 @@ export default {
|
||||||
|
|
||||||
.node-operate > i {
|
.node-operate > i {
|
||||||
color: #409eff;
|
color: #409eff;
|
||||||
margin: 0px 5px;
|
margin: 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name-input {
|
.name-input {
|
||||||
|
@ -766,6 +758,10 @@ export default {
|
||||||
color: transparent;
|
color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tree-node__content > .el-tree-node__expand-icon {
|
||||||
|
padding: 9px 6px 6px 6px;
|
||||||
|
}
|
||||||
|
|
||||||
:deep(.el-tree-node__content) {
|
:deep(.el-tree-node__content) {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
@ -808,8 +804,8 @@ export default {
|
||||||
|
|
||||||
.drag {
|
.drag {
|
||||||
position: relative;
|
position: relative;
|
||||||
left: -38px;
|
left: -40px;
|
||||||
top: 2px;
|
top: 0;
|
||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +853,7 @@ export default {
|
||||||
|
|
||||||
.module-more-operate {
|
.module-more-operate {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
margin-top: 0px;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
|
|
|
@ -73,11 +73,13 @@ public class AttachmentController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/metadata/relate")
|
@PostMapping("/metadata/relate")
|
||||||
|
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, title = "#request.belongType", content = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds, true)", msClass = AttachmentService.class)
|
||||||
public void relate(@RequestBody AttachmentRequest request) {
|
public void relate(@RequestBody AttachmentRequest request) {
|
||||||
attachmentService.relate(request);
|
attachmentService.relate(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/metadata/unrelated")
|
@PostMapping("/metadata/unrelated")
|
||||||
|
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.UPDATE, title = "#request.belongType", beforeEvent = "#msClass.getLogDetails(#request.belongId, #request.belongType, #request.metadataRefIds)", msClass = AttachmentService.class)
|
||||||
public void unrelated(@RequestBody AttachmentRequest request) {
|
public void unrelated(@RequestBody AttachmentRequest request) {
|
||||||
attachmentService.unrelated(request);
|
attachmentService.unrelated(request);
|
||||||
}
|
}
|
||||||
|
|
|
@ -642,6 +642,13 @@ public class AttachmentService {
|
||||||
return JSON.toJSONString(details);
|
return JSON.toJSONString(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除文件操作记录
|
||||||
|
*
|
||||||
|
* @param attachmentId
|
||||||
|
* @param attachmentType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getLogDetails(String attachmentId, String attachmentType) {
|
public String getLogDetails(String attachmentId, String attachmentType) {
|
||||||
FileAttachmentMetadata fileAttachmentMetadata = fileAttachmentMetadataMapper.selectByPrimaryKey(attachmentId);
|
FileAttachmentMetadata fileAttachmentMetadata = fileAttachmentMetadataMapper.selectByPrimaryKey(attachmentId);
|
||||||
if (fileAttachmentMetadata == null) {
|
if (fileAttachmentMetadata == null) {
|
||||||
|
@ -658,4 +665,112 @@ public class AttachmentService {
|
||||||
return this.getLogDetails(relationId, attachmentType, fileName, true);
|
return this.getLogDetails(relationId, attachmentType, fileName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联文件的操作记录
|
||||||
|
*
|
||||||
|
* @param sourceId
|
||||||
|
* @param type
|
||||||
|
* @param refIds 关联或取消关联的文件ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getLogDetails(String sourceId, String type, List refIds, Boolean isRelate) {
|
||||||
|
String projectId = null;
|
||||||
|
String createUser = null;
|
||||||
|
if (StringUtils.isBlank(sourceId) || StringUtils.isBlank(type) || CollectionUtils.isEmpty(refIds)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (AttachmentType.ISSUE.type().equals(type)) {
|
||||||
|
IssuesWithBLOBs issues = issuesMapper.selectByPrimaryKey(sourceId);
|
||||||
|
if (issues == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
projectId = issues.getProjectId();
|
||||||
|
createUser = issues.getCreator();
|
||||||
|
} else if (AttachmentType.TEST_CASE.type().equals(type)) {
|
||||||
|
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(sourceId);
|
||||||
|
if (testCase == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
projectId = testCase.getProjectId();
|
||||||
|
createUser = testCase.getCreateUser();
|
||||||
|
}
|
||||||
|
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||||
|
attachmentRequest.setBelongId(sourceId);
|
||||||
|
attachmentRequest.setBelongType(type);
|
||||||
|
List<FileAttachmentMetadata> originFiles = listMetadata(attachmentRequest);
|
||||||
|
List<String> fileNames = new LinkedList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(originFiles)) {
|
||||||
|
fileNames = originFiles.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
String after;
|
||||||
|
String before;
|
||||||
|
|
||||||
|
FileMetadataExample example = new FileMetadataExample();
|
||||||
|
example.createCriteria().andIdIn(refIds);
|
||||||
|
List<FileMetadata> fileMetadata = fileMetadataMapper.selectByExample(example);
|
||||||
|
List<String> refNames = fileMetadata.stream().map(FileMetadata::getName).collect(Collectors.toList());
|
||||||
|
|
||||||
|
after = String.join(",", fileNames);
|
||||||
|
List<String> unRelateFiles = fileNames.stream().filter(filename -> !refNames.contains(filename)).collect(Collectors.toList());
|
||||||
|
before = String.join(",", unRelateFiles);
|
||||||
|
|
||||||
|
List<DetailColumn> columns = new ArrayList<>();
|
||||||
|
DetailColumn column = new DetailColumn("附件", "files", before, after);
|
||||||
|
columns.add(column);
|
||||||
|
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, createUser, columns);
|
||||||
|
return JSON.toJSONString(details);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消关联文件的操作记录
|
||||||
|
*
|
||||||
|
* @param sourceId
|
||||||
|
* @param type
|
||||||
|
* @param refIds 关联或取消关联的文件ID
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getLogDetails(String sourceId, String type, List refIds) {
|
||||||
|
String projectId = null;
|
||||||
|
String createUser = null;
|
||||||
|
if (StringUtils.isBlank(sourceId) || StringUtils.isBlank(type) || CollectionUtils.isEmpty(refIds)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (AttachmentType.ISSUE.type().equals(type)) {
|
||||||
|
IssuesWithBLOBs issues = issuesMapper.selectByPrimaryKey(sourceId);
|
||||||
|
if (issues == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
projectId = issues.getProjectId();
|
||||||
|
createUser = issues.getCreator();
|
||||||
|
} else if (AttachmentType.TEST_CASE.type().equals(type)) {
|
||||||
|
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(sourceId);
|
||||||
|
if (testCase == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
projectId = testCase.getProjectId();
|
||||||
|
createUser = testCase.getCreateUser();
|
||||||
|
}
|
||||||
|
AttachmentRequest attachmentRequest = new AttachmentRequest();
|
||||||
|
attachmentRequest.setBelongId(sourceId);
|
||||||
|
attachmentRequest.setBelongType(type);
|
||||||
|
List<FileAttachmentMetadata> originFiles = listMetadata(attachmentRequest);
|
||||||
|
List<String> fileNames = new LinkedList<>();
|
||||||
|
if (CollectionUtils.isNotEmpty(originFiles)) {
|
||||||
|
fileNames = originFiles.stream().map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
String after;
|
||||||
|
String before;
|
||||||
|
|
||||||
|
before = String.join(",", fileNames);
|
||||||
|
List<String> unRelateFiles = originFiles.stream().filter(originFile -> !StringUtils.equals(originFile.getId(), refIds.get(0).toString()))
|
||||||
|
.map(FileAttachmentMetadata::getName).collect(Collectors.toList());
|
||||||
|
after = String.join(",", unRelateFiles);
|
||||||
|
|
||||||
|
List<DetailColumn> columns = new ArrayList<>();
|
||||||
|
DetailColumn column = new DetailColumn("附件", "files", before, after);
|
||||||
|
columns.add(column);
|
||||||
|
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(sourceId), projectId, createUser, columns);
|
||||||
|
return JSON.toJSONString(details);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
:auto-save="!readOnly"
|
:auto-save="!readOnly"
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
:contentObject="{
|
:contentObject="{
|
||||||
content: isCustomNum ? form.customNum : form.num,
|
content: isCustomNum ? form.customNum.toString() : form.num.toString(),
|
||||||
contentType: 'INPUT',
|
contentType: 'INPUT',
|
||||||
}"
|
}"
|
||||||
:readonlyHoverEvent="!readOnly"
|
:readonlyHoverEvent="!readOnly"
|
||||||
|
|
Loading…
Reference in New Issue