fix(用例管理): 批量复制用例日志

--bug=1036375 --user=王旭 【项目管理】批量复制用例-项目管理日志未产生日志 https://www.tapd.cn/55049933/s/1472360
This commit is contained in:
WangXu10 2024-03-11 11:44:59 +08:00 committed by 刘瑞斌
parent ba005264e3
commit 5200c3a61d
2 changed files with 12 additions and 3 deletions

View File

@ -190,7 +190,8 @@ public class FunctionalCaseController {
@CheckOwner(resourceId = "#request.getProjectId()", resourceType = "project")
public void batchCopyFunctionalCase(@Validated @RequestBody FunctionalCaseBatchMoveRequest request) {
String userId = SessionUtils.getUserId();
functionalCaseService.batchCopyFunctionalCase(request, userId);
String organizationId = SessionUtils.getCurrentOrganizationId();
functionalCaseService.batchCopyFunctionalCase(request, userId, organizationId);
}
@ -246,7 +247,7 @@ public class FunctionalCaseController {
@CheckOwner(resourceId = "#request.getSourceId()", resourceType = "functional_case")
public Pager<List<OperationHistoryDTO>> operationHistoryList(@Validated @RequestBody OperationHistoryRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "create_time desc");
return PageUtils.setPageInfo(page, functionalCaseService.operationHistoryList(request));
}
}

View File

@ -734,7 +734,7 @@ public class FunctionalCaseService {
* @param userId userId
*/
@Async
public void batchCopyFunctionalCase(FunctionalCaseBatchMoveRequest request, String userId) {
public void batchCopyFunctionalCase(FunctionalCaseBatchMoveRequest request, String userId, String organizationId) {
List<String> ids = doSelectIds(request, request.getProjectId());
if (CollectionUtils.isNotEmpty(ids)) {
//基本信息
@ -800,6 +800,14 @@ public class FunctionalCaseService {
functionalCaseAttachmentService.association(fileIds, id, userId, FUNCTIONAL_CASE_BATCH_COPY_FILE_LOG_URL, request.getProjectId());
}
//日志
FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO();
historyLogDTO.setFunctionalCase(functionalCase);
historyLogDTO.setFunctionalCaseBlob(functionalCaseBlob);
historyLogDTO.setCustomFields(customFields);
historyLogDTO.setCaseAttachments(caseAttachments);
historyLogDTO.setFileAssociationList(fileAssociationList);
saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.CASE_MANAGEMENT_CASE_CREATE);
}
}
}