diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDocShareDTO.java b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDocShareDTO.java
index 7928a64932..6e4070a269 100644
--- a/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDocShareDTO.java
+++ b/backend/services/api-test/src/main/java/io/metersphere/api/dto/definition/ApiDocShareDTO.java
@@ -20,4 +20,7 @@ public class ApiDocShareDTO extends ApiDocShare {
@Schema(title = "截止日期")
private Long deadline;
+
+ @Schema(title = "创建人")
+ private String createUserName;
}
diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDocShareMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDocShareMapper.xml
index 375f65bf14..270f73a0a8 100644
--- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDocShareMapper.xml
+++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiDocShareMapper.xml
@@ -19,6 +19,23 @@
and name like concat('%', #{request.keyword},'%')
+
+
+
+
+
+
+
+
+
+ and create_user in
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDocShareService.java b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDocShareService.java
index f921d3422a..0acd788715 100644
--- a/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDocShareService.java
+++ b/backend/services/api-test/src/main/java/io/metersphere/api/service/definition/ApiDocShareService.java
@@ -15,6 +15,7 @@ import io.metersphere.sdk.exception.MSException;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.dto.sdk.BaseTreeNode;
+import io.metersphere.system.service.UserToolService;
import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
import org.apache.commons.collections4.CollectionUtils;
@@ -22,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -34,6 +36,8 @@ import java.util.Map;
@Transactional(rollbackFor = Exception.class)
public class ApiDocShareService {
+ @Resource
+ private UserToolService userToolService;
@Resource
private ExtApiDefinitionMapper extApiDefinitionMapper;
@Resource
@@ -53,8 +57,11 @@ public class ApiDocShareService {
* @return 分享列表
*/
public List list(ApiDocSharePageRequest request) {
- List list = extApiDocShareMapper.list(request);
- return buildApiShareExtra(list);
+ List shareList = extApiDocShareMapper.list(request);
+ if (CollectionUtils.isEmpty(shareList)) {
+ return new ArrayList<>();
+ }
+ return buildApiShareExtra(shareList);
}
/**
@@ -170,10 +177,13 @@ public class ApiDocShareService {
* @return 分享列表
*/
public List buildApiShareExtra(List docShares) {
+ List distinctUserIds = docShares.stream().map(ApiDocShareDTO::getCreateUser).distinct().toList();
+ Map userMap = userToolService.getUserMapByIds(distinctUserIds);
docShares.forEach(docShare -> {
docShare.setDeadline(calculateDeadline(docShare.getInvalidTime(), docShare.getInvalidUnit(), docShare.getCreateTime()));
docShare.setInvalid(docShare.getDeadline() != null && docShare.getDeadline() < System.currentTimeMillis());
docShare.setApiShareNum(countApiShare(docShare));
+ docShare.setCreateUserName(userMap.get(docShare.getCreateUser()));
});
return docShares;
}
diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java
index f97de3cd0e..1bfbab3467 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/controller/SystemTaskHubController.java
@@ -16,7 +16,6 @@ import io.metersphere.system.dto.taskhub.response.TaskStatisticsResponse;
import io.metersphere.system.log.annotation.Log;
import io.metersphere.system.log.constants.OperationLogModule;
import io.metersphere.system.log.constants.OperationLogType;
-import io.metersphere.system.security.CheckOwner;
import io.metersphere.system.service.BaseTaskHubLogService;
import io.metersphere.system.service.BaseTaskHubService;
import io.metersphere.system.utils.PageUtils;
diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/BatchExecTaskReportDTO.java b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/BatchExecTaskReportDTO.java
index c78af7d13d..fd8b10e001 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/dto/BatchExecTaskReportDTO.java
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/dto/BatchExecTaskReportDTO.java
@@ -25,6 +25,8 @@ public class BatchExecTaskReportDTO {
private String triggerMode;
@Schema(description = "创建人")
private String createUser;
+ @Schema(description = "创建人名称")
+ private String createUserName;
@Schema(description = "创建时间")
private Long createTime;
}
diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml
index f237a48473..ff9b2bc047 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/mapper/ExtExecTaskItemMapper.xml
@@ -84,6 +84,12 @@
+
+
+
+
+
+
@@ -110,6 +116,31 @@
+
+
+
+
+
+
+
+ and r.status in
+
+
+
+
+ and r.result in
+
+
+
+
+ and r.trigger_mode in
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java
index d96ba646a4..8857b61cf7 100644
--- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java
+++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java
@@ -119,6 +119,8 @@ public class BaseTaskHubService {
private OperationLogService operationLogService;
@Resource
ApiScheduleNoticeService apiScheduleNoticeService;
+ @Resource
+ private UserToolService userToolService;
/**
@@ -862,10 +864,18 @@ public class BaseTaskHubService {
* @return 执行任务报告集合
*/
public List listBatchTaskReport(BatchExecTaskPageRequest request) {
+ List batchReportList;
if (StringUtils.equals(ExecTaskType.API_CASE_BATCH.name(), request.getBatchType())) {
- return extExecTaskItemMapper.list(request, "api_report");
+ batchReportList = extExecTaskItemMapper.list(request, "api_report");
} else {
- return extExecTaskItemMapper.list(request, "api_scenario_report");
+ batchReportList = extExecTaskItemMapper.list(request, "api_scenario_report");
}
+ if (CollectionUtils.isEmpty(batchReportList)) {
+ return new ArrayList<>();
+ }
+ List userIds = batchReportList.stream().map(BatchExecTaskReportDTO::getCreateUser).toList();
+ Map userMap = userToolService.getUserMapByIds(userIds);
+ batchReportList.forEach(item -> item.setCreateUserName(userMap.get(item.getCreateUser())));
+ return batchReportList;
}
}