fix(测试跟踪): 功能用例关联新建的缺陷需生成两条操作日志
--bug=1026281 --user=宋昌昌 【项目设置】功能用例-关联缺陷-创建缺陷-操作日志只生成了一条创建缺陷记录-没生成关联缺陷记录 https://www.tapd.cn/55049933/s/1373070
This commit is contained in:
parent
9cdba005b0
commit
8420ec4d4b
|
@ -26,6 +26,7 @@ import io.metersphere.excel.handler.IssueTemplateHeadWriteHandler;
|
|||
import io.metersphere.excel.listener.IssueExcelListener;
|
||||
import io.metersphere.excel.utils.EasyExcelExporter;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.log.annotation.MsAuditLog;
|
||||
import io.metersphere.log.utils.ReflexObjectUtil;
|
||||
import io.metersphere.log.vo.DetailColumn;
|
||||
import io.metersphere.log.vo.OperatingLogDetails;
|
||||
|
@ -92,6 +93,9 @@ import java.util.stream.Collectors;
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public class IssuesService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private IssuesService issuesService;
|
||||
@Resource
|
||||
private BaseIntegrationService baseIntegrationService;
|
||||
@Resource
|
||||
|
@ -348,11 +352,11 @@ public class IssuesService {
|
|||
if (!org.springframework.util.CollectionUtils.isEmpty(addCaseIds)) {
|
||||
if (issuesRequest.getIsPlanEdit()) {
|
||||
addCaseIds.forEach(caseId -> {
|
||||
testCaseIssueService.add(issuesId, caseId, issuesRequest.getRefId(), IssueRefType.PLAN_FUNCTIONAL.name());
|
||||
issuesService.insertIssueRelateLog(issuesId, caseId, issuesRequest.getRefId(), IssueRefType.PLAN_FUNCTIONAL.name());
|
||||
testCaseIssueService.updateIssuesCount(caseId);
|
||||
});
|
||||
} else {
|
||||
addCaseIds.forEach(caseId -> testCaseIssueService.add(issuesId, caseId, null, IssueRefType.FUNCTIONAL.name()));
|
||||
addCaseIds.forEach(caseId -> issuesService.insertIssueRelateLog(issuesId, caseId, null, IssueRefType.FUNCTIONAL.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2012,4 +2016,9 @@ public class IssuesService {
|
|||
}
|
||||
return tapdUsers;
|
||||
}
|
||||
|
||||
@MsAuditLog(module = OperLogModule.TRACK_TEST_CASE, type = OperLogConstants.ASSOCIATE_ISSUE, content = "#msClass.getIssueLogDetails(#caseId, #issuesId)", msClass = TestCaseIssueService.class)
|
||||
public void insertIssueRelateLog(String issuesId, String caseId, String refId, String refType) {
|
||||
testCaseIssueService.add(issuesId, caseId, refId, refType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -139,4 +139,14 @@ public class TestCaseIssueService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getIssueLogDetails(String caseResourceId, String issuesId) {
|
||||
TestCaseWithBLOBs bloBs = testCaseService.getTestCase(caseResourceId);
|
||||
if (bloBs != null) {
|
||||
IssuesWithBLOBs issuesWithBLOBs = issuesMapper.selectByPrimaryKey(issuesId);
|
||||
OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(issuesId), bloBs.getProjectId(), bloBs.getName() + " 关联 " + issuesWithBLOBs.getTitle(), bloBs.getCreateUser(), new LinkedList<>());
|
||||
return JSON.toJSONString(details);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue