refactor(测试计划): 执行历史展示优化

This commit is contained in:
WangXu10 2024-05-17 19:30:02 +08:00 committed by Craftsman
parent cca651fa26
commit aba2e91ef9
3 changed files with 12 additions and 33 deletions

View File

@ -1,53 +1,27 @@
package io.metersphere.plan.dto.response; package io.metersphere.plan.dto.response;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
/** /**
* @author wx * @author wx
*/ */
@Data @Data
public class TestPlanCaseExecHistoryResponse implements Serializable { public class TestPlanCaseExecHistoryResponse extends TestPlanCaseExecuteHistory {
@Serial @Schema(description = "评审解析内容")
private static final long serialVersionUID = 1L;
@Schema(description = "id")
private String id;
@Schema(description = "用例id")
private String caseId;
@Schema(description = "执行结果")
private String status;
@Schema(description = "评论内容")
private byte[] content;
@Schema(description = "评审解析内容")
private String contentText; private String contentText;
@Schema(description = "步骤结果") @Schema(description = "步骤结果")
private String stepsExecResult; private String stepsExecResult;
@Schema(description = "执行人")
private String createUser;
@Schema(description = "执行人姓名") @Schema(description = "执行人姓名")
private String userName; private String userName;
@Schema(description = "执行人头像") @Schema(description = "执行人头像")
private String userLogo; private String userLogo;
@Schema(description = "执行人邮箱") @Schema(description = "执行人邮箱")
private String email; private String email;
@Schema(description = "执行时间")
private String createTime;
@Schema(description = "通知人")
private String notifier;
} }

View File

@ -19,7 +19,7 @@
tpceh.case_id as caseId, tpceh.case_id as caseId,
tpceh.status as status, tpceh.status as status,
tpceh.content as content, tpceh.content as content,
tpceh.steps as stepsExecResult, tpceh.steps as steps,
tpceh.create_user as createUser, tpceh.create_user as createUser,
tpceh.create_time as createTime, tpceh.create_time as createTime,
tpceh.notifier as notifier, tpceh.notifier as notifier,

View File

@ -436,7 +436,9 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
executeHistory.setTestPlanId(request.getTestPlanId()); executeHistory.setTestPlanId(request.getTestPlanId());
executeHistory.setCaseId(request.getCaseId()); executeHistory.setCaseId(request.getCaseId());
executeHistory.setStatus(request.getLastExecResult()); executeHistory.setStatus(request.getLastExecResult());
executeHistory.setContent(request.getContent().getBytes()); if (StringUtils.isNotBlank(request.getContent())) {
executeHistory.setContent(request.getContent().getBytes());
}
executeHistory.setSteps(StringUtils.defaultIfBlank(request.getStepsExecResult(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8)); executeHistory.setSteps(StringUtils.defaultIfBlank(request.getStepsExecResult(), StringUtils.EMPTY).getBytes(StandardCharsets.UTF_8));
executeHistory.setDeleted(false); executeHistory.setDeleted(false);
executeHistory.setNotifier(request.getNotifier()); executeHistory.setNotifier(request.getNotifier());
@ -545,6 +547,9 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
if (item.getContent() != null) { if (item.getContent() != null) {
item.setContentText(new String(item.getContent(), StandardCharsets.UTF_8)); item.setContentText(new String(item.getContent(), StandardCharsets.UTF_8));
} }
if (item.getSteps() != null) {
item.setStepsExecResult(new String(item.getSteps(), StandardCharsets.UTF_8));
}
}); });
return list; return list;
} }