fix: 测试计划负责人查询问题

This commit is contained in:
shiziyuan9527 2021-09-29 18:33:00 +08:00 committed by shiziyuan9527
parent 2bf69c61a4
commit 55e7ebba8e
11 changed files with 150 additions and 324 deletions

View File

@ -19,8 +19,6 @@ public class TestPlan implements Serializable {
private String stage;
private String principal;
private String testCaseMatchRule;
private String executorMatchRule;
@ -29,14 +27,14 @@ public class TestPlan implements Serializable {
private Long updateTime;
private Long actualEndTime;
private Long plannedStartTime;
private Long plannedEndTime;
private Long actualStartTime;
private Long actualEndTime;
private String creator;
private String projectId;

View File

@ -594,76 +594,6 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andPrincipalIsNull() {
addCriterion("principal is null");
return (Criteria) this;
}
public Criteria andPrincipalIsNotNull() {
addCriterion("principal is not null");
return (Criteria) this;
}
public Criteria andPrincipalEqualTo(String value) {
addCriterion("principal =", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotEqualTo(String value) {
addCriterion("principal <>", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalGreaterThan(String value) {
addCriterion("principal >", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalGreaterThanOrEqualTo(String value) {
addCriterion("principal >=", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLessThan(String value) {
addCriterion("principal <", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLessThanOrEqualTo(String value) {
addCriterion("principal <=", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalLike(String value) {
addCriterion("principal like", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotLike(String value) {
addCriterion("principal not like", value, "principal");
return (Criteria) this;
}
public Criteria andPrincipalIn(List<String> values) {
addCriterion("principal in", values, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotIn(List<String> values) {
addCriterion("principal not in", values, "principal");
return (Criteria) this;
}
public Criteria andPrincipalBetween(String value1, String value2) {
addCriterion("principal between", value1, value2, "principal");
return (Criteria) this;
}
public Criteria andPrincipalNotBetween(String value1, String value2) {
addCriterion("principal not between", value1, value2, "principal");
return (Criteria) this;
}
public Criteria andTestCaseMatchRuleIsNull() {
addCriterion("test_case_match_rule is null");
return (Criteria) this;
@ -924,6 +854,66 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andActualEndTimeIsNull() {
addCriterion("actual_end_time is null");
return (Criteria) this;
}
public Criteria andActualEndTimeIsNotNull() {
addCriterion("actual_end_time is not null");
return (Criteria) this;
}
public Criteria andActualEndTimeEqualTo(Long value) {
addCriterion("actual_end_time =", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotEqualTo(Long value) {
addCriterion("actual_end_time <>", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThan(Long value) {
addCriterion("actual_end_time >", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("actual_end_time >=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThan(Long value) {
addCriterion("actual_end_time <", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThanOrEqualTo(Long value) {
addCriterion("actual_end_time <=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeIn(List<Long> values) {
addCriterion("actual_end_time in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotIn(List<Long> values) {
addCriterion("actual_end_time not in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeBetween(Long value1, Long value2) {
addCriterion("actual_end_time between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotBetween(Long value1, Long value2) {
addCriterion("actual_end_time not between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andPlannedStartTimeIsNull() {
addCriterion("planned_start_time is null");
return (Criteria) this;
@ -1104,66 +1094,6 @@ public class TestPlanExample {
return (Criteria) this;
}
public Criteria andActualEndTimeIsNull() {
addCriterion("actual_end_time is null");
return (Criteria) this;
}
public Criteria andActualEndTimeIsNotNull() {
addCriterion("actual_end_time is not null");
return (Criteria) this;
}
public Criteria andActualEndTimeEqualTo(Long value) {
addCriterion("actual_end_time =", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotEqualTo(Long value) {
addCriterion("actual_end_time <>", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThan(Long value) {
addCriterion("actual_end_time >", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("actual_end_time >=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThan(Long value) {
addCriterion("actual_end_time <", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeLessThanOrEqualTo(Long value) {
addCriterion("actual_end_time <=", value, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeIn(List<Long> values) {
addCriterion("actual_end_time in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotIn(List<Long> values) {
addCriterion("actual_end_time not in", values, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeBetween(Long value1, Long value2) {
addCriterion("actual_end_time between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andActualEndTimeNotBetween(Long value1, Long value2) {
addCriterion("actual_end_time not between", value1, value2, "actualEndTime");
return (Criteria) this;
}
public Criteria andCreatorIsNull() {
addCriterion("creator is null");
return (Criteria) this;

View File

@ -9,15 +9,14 @@
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="stage" jdbcType="VARCHAR" property="stage" />
<result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
<result column="creator" jdbcType="VARCHAR" property="creator" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="execution_times" jdbcType="INTEGER" property="executionTimes" />
@ -87,9 +86,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time, planned_start_time, planned_end_time,
actual_start_time, actual_end_time, creator, project_id, execution_times, automatic_status_update
id, workspace_id, report_id, `name`, description, `status`, stage, test_case_match_rule,
executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
planned_end_time, actual_start_time, creator, project_id, execution_times, automatic_status_update
</sql>
<sql id="Blob_Column_List">
tags, report_summary, report_config
@ -145,20 +144,20 @@
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanWithBLOBs">
insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`,
stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time,
stage, test_case_match_rule, executor_match_rule,
create_time, update_time, actual_end_time,
planned_start_time, planned_end_time, actual_start_time,
actual_end_time, creator, project_id,
execution_times, automatic_status_update, tags,
report_summary, report_config)
creator, project_id, execution_times,
automatic_status_update, tags, report_summary,
report_config)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{stage,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, #{executorMatchRule,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{actualEndTime,jdbcType=BIGINT},
#{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT}, #{actualStartTime,jdbcType=BIGINT},
#{actualEndTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR},
#{executionTimes,jdbcType=INTEGER}, #{automaticStatusUpdate,jdbcType=BIT}, #{tags,jdbcType=LONGVARCHAR},
#{reportSummary,jdbcType=LONGVARCHAR}, #{reportConfig,jdbcType=LONGVARCHAR})
#{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{executionTimes,jdbcType=INTEGER},
#{automaticStatusUpdate,jdbcType=BIT}, #{tags,jdbcType=LONGVARCHAR}, #{reportSummary,jdbcType=LONGVARCHAR},
#{reportConfig,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanWithBLOBs">
insert into test_plan
@ -184,9 +183,6 @@
<if test="stage != null">
stage,
</if>
<if test="principal != null">
principal,
</if>
<if test="testCaseMatchRule != null">
test_case_match_rule,
</if>
@ -199,6 +195,9 @@
<if test="updateTime != null">
update_time,
</if>
<if test="actualEndTime != null">
actual_end_time,
</if>
<if test="plannedStartTime != null">
planned_start_time,
</if>
@ -208,9 +207,6 @@
<if test="actualStartTime != null">
actual_start_time,
</if>
<if test="actualEndTime != null">
actual_end_time,
</if>
<if test="creator != null">
creator,
</if>
@ -255,9 +251,6 @@
<if test="stage != null">
#{stage,jdbcType=VARCHAR},
</if>
<if test="principal != null">
#{principal,jdbcType=VARCHAR},
</if>
<if test="testCaseMatchRule != null">
#{testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -270,6 +263,9 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
#{actualEndTime,jdbcType=BIGINT},
</if>
<if test="plannedStartTime != null">
#{plannedStartTime,jdbcType=BIGINT},
</if>
@ -279,9 +275,6 @@
<if test="actualStartTime != null">
#{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
#{actualEndTime,jdbcType=BIGINT},
</if>
<if test="creator != null">
#{creator,jdbcType=VARCHAR},
</if>
@ -335,9 +328,6 @@
<if test="record.stage != null">
stage = #{record.stage,jdbcType=VARCHAR},
</if>
<if test="record.principal != null">
principal = #{record.principal,jdbcType=VARCHAR},
</if>
<if test="record.testCaseMatchRule != null">
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -350,6 +340,9 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.actualEndTime != null">
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
</if>
<if test="record.plannedStartTime != null">
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
</if>
@ -359,9 +352,6 @@
<if test="record.actualStartTime != null">
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
</if>
<if test="record.actualEndTime != null">
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
</if>
<if test="record.creator != null">
creator = #{record.creator,jdbcType=VARCHAR},
</if>
@ -397,15 +387,14 @@
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
@ -426,15 +415,14 @@
description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
creator = #{record.creator,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
execution_times = #{record.executionTimes,jdbcType=INTEGER},
@ -464,9 +452,6 @@
<if test="stage != null">
stage = #{stage,jdbcType=VARCHAR},
</if>
<if test="principal != null">
principal = #{principal,jdbcType=VARCHAR},
</if>
<if test="testCaseMatchRule != null">
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
</if>
@ -479,6 +464,9 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="plannedStartTime != null">
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
</if>
@ -488,9 +476,6 @@
<if test="actualStartTime != null">
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="creator != null">
creator = #{creator,jdbcType=VARCHAR},
</if>
@ -523,15 +508,14 @@
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},
@ -549,15 +533,14 @@
description = #{description,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
stage = #{stage,jdbcType=VARCHAR},
principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
creator = #{creator,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
execution_times = #{executionTimes,jdbcType=INTEGER},

View File

@ -64,12 +64,6 @@
<property name="object" value="${condition}.projectName"/>
</include>
</if>
<if test="${condition}.principal != null">
and test_plan.principal
<include refid="condition">
<property name="object" value="${condition}.principal"/>
</include>
</if>
<if test="${condition}.createTime != null">
and test_plan.create_time
<include refid="condition">
@ -98,11 +92,10 @@
<select id="list" resultType="io.metersphere.track.dto.TestPlanDTOWithMetric"
parameterType="io.metersphere.track.request.testcase.QueryTestPlanRequest">
select DISTINCT test_plan.*, user.name as user_name, project.name as projectName,schedule.id as scheduleId,
select DISTINCT test_plan.*, project.name as projectName,schedule.id as scheduleId,
(select name from user where user.id = test_plan.creator) as createUser,
IF(schedule.enable = true,true,false) as scheduleOpen
from test_plan
LEFT JOIN user ON user.id = test_plan.principal
LEFT JOIN schedule ON schedule.resource_id = test_plan.id
JOIN project on project.id = test_plan.project_id
<where>

View File

@ -74,11 +74,6 @@ public class TestPlanController {
return testPlanService.listTestAllPlan(request);
}
@PostMapping("/list/all/relate")
public List<TestPlanDTOWithMetric> listRelateAll() {
return testPlanService.listRelateAllPlan();
}
@GetMapping("recent/{count}/{id}")
public List<TestPlan> recentTestPlans(@PathVariable("count") int count, @PathVariable("id") String projectId) {
PageHelper.startPage(1, count, true);

View File

@ -1,12 +1,18 @@
package io.metersphere.track.domain;
import io.metersphere.base.domain.TestPlanPrincipal;
import io.metersphere.base.domain.TestPlanPrincipalExample;
import io.metersphere.base.mapper.TestPlanPrincipalMapper;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReportMetricDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.dto.TestPlanDTO;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
public class ReportBaseInfoComponent extends ReportComponent {
private Set<String> executorsSet = new HashSet<>();
@ -24,13 +30,32 @@ public class ReportBaseInfoComponent extends ReportComponent {
@Override
public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) {
testCaseReportMetric.setProjectName(testPlan.getProjectName());
testCaseReportMetric.setPrincipal(testPlan.getPrincipal());
List<String> principalIds = new ArrayList<>();
if (StringUtils.isNotBlank(testPlan.getId())) {
TestPlanPrincipalMapper testPlanPrincipalMapper = CommonBeanFactory.getBean(TestPlanPrincipalMapper.class);
TestPlanPrincipalExample example = new TestPlanPrincipalExample();
example.createCriteria().andTestPlanIdEqualTo(testPlan.getId());
if (testPlanPrincipalMapper != null) {
List<TestPlanPrincipal> principals = testPlanPrincipalMapper.selectByExample(example);
principalIds = principals.stream().map(TestPlanPrincipal::getPrincipalId).collect(Collectors.toList());
}
}
testCaseReportMetric.setExecutors(new ArrayList<>(this.executorsSet));
List<String> userIds = new ArrayList<>();
userIds.add(testPlan.getPrincipal());
userIds.addAll(principalIds);
userIds.addAll(testCaseReportMetric.getExecutors());
Map<String, String> userMap = ServiceUtils.getUserNameMap(userIds);
testCaseReportMetric.setPrincipalName(userMap.get(testCaseReportMetric.getPrincipal()));
String principalName = "";
for (String principalId : principalIds) {
String name = userMap.get(principalId);
if (StringUtils.isNotBlank(principalName)) {
principalName = principalName + "" +name;
} else {
principalName = principalName + name;
}
}
testCaseReportMetric.setPrincipalName(principalName);
List<String> names = new ArrayList<>();
testCaseReportMetric.getExecutors().forEach(item -> {
if (StringUtils.isNotBlank(item)) {

View File

@ -31,6 +31,7 @@ public class TestPlanReportDTO {
private List<Issues> Issues;
private List<String> executors;
private String principal;
private String principalName;
private Long startTime;
private Long endTime;
private String projectName;

View File

@ -86,6 +86,8 @@ public class TestPlanReportService {
TestPlanReportContentMapper testPlanReportContentMapper;
@Resource
ShareInfoService shareInfoService;
@Resource
private TestPlanPrincipalMapper testPlanPrincipalMapper;
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
@ -256,7 +258,7 @@ public class TestPlanReportService {
TestPlanReportExecuteCatch.addApiTestPlanExecuteInfo(testPlanReportID,saveRequest.getUserId(), apiCaseInfoMap, scenarioInfoMap, performanceInfoMap);
testPlanReport.setPrincipal(testPlan.getPrincipal());
// testPlanReport.setPrincipal(testPlan.getPrincipal());
if (testPlanReport.getIsScenarioExecuting() || testPlanReport.getIsApiCaseExecuting() || testPlanReport.getIsPerformanceExecuting()) {
testPlanReport.setStatus(APITestStatus.Running.name());
} else {
@ -297,7 +299,9 @@ public class TestPlanReportService {
List<String> creatorList = new ArrayList<>();
creatorList.add(report.getCreator());
returnDTO.setExecutors(creatorList);
returnDTO.setPrincipal(report.getPrincipal());
String name = getPrincipalName(report.getTestPlanId());
returnDTO.setPrincipal(name);
returnDTO.setPrincipalName(name);
returnDTO.setStartTime(report.getStartTime());
returnDTO.setEndTime(report.getEndTime());
@ -315,6 +319,27 @@ public class TestPlanReportService {
return returnDTO;
}
private String getPrincipalName(String planId) {
if (StringUtils.isBlank(planId)) {
return "";
}
String principalName = "";
TestPlanPrincipalExample example = new TestPlanPrincipalExample();
example.createCriteria().andTestPlanIdEqualTo(planId);
List<TestPlanPrincipal> principals = testPlanPrincipalMapper.selectByExample(example);
List<String> principalIds = principals.stream().map(TestPlanPrincipal::getPrincipalId).collect(Collectors.toList());
Map<String, String> userMap = ServiceUtils.getUserNameMap(principalIds);
for (String principalId : principalIds) {
String name = userMap.get(principalId);
if (StringUtils.isNotBlank(principalName)) {
principalName = principalName + "" +name;
} else {
principalName = principalName + name;
}
}
return principalName;
}
public synchronized void updateReport(List<String> testPlanReportIdList, String runMode, String triggerMode) {
for (String planReportId : testPlanReportIdList) {
this.countReportByTestPlanReportId(planReportId, runMode, triggerMode, null);

View File

@ -631,18 +631,6 @@ public class TestPlanService {
return testPlanMapper.selectByExample(example);
}
public List<TestPlanDTOWithMetric> listRelateAllPlan() {
SessionUser user = SessionUtils.getUser();
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setPrincipal(user.getId());
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
request.setProjectId(SessionUtils.getCurrentProjectId());
request.setPlanIds(extTestPlanTestCaseMapper.findRelateTestPlanId(user.getId(), SessionUtils.getCurrentWorkspaceId(), SessionUtils.getCurrentProjectId()));
List<TestPlanDTOWithMetric> testPlans = extTestPlanMapper.listRelate(request);
calcTestPlanRate(testPlans);
return testPlans;
}
public List<TestPlanCaseDTO> listTestCaseByPlanId(String planId) {
QueryTestPlanCaseRequest request = new QueryTestPlanCaseRequest();
request.setPlanId(planId);

View File

@ -0,0 +1 @@
alter table test_plan drop column principal;

View File

@ -1,113 +0,0 @@
<template>
<home-base-component :title="$t('test_track.home.my_plan')" v-loading>
<el-table
class="adjust-table"
border
:data="tableData"
@row-click="intoPlan"
v-loading="result.loading" height="300px">
<el-table-column
prop="name"
fixed
:label="$t('commons.name')"
show-overflow-tooltip>
</el-table-column>
<el-table-column
prop="status"
:label="$t('test_track.plan.plan_status')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-status-table-item :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.pass_rate')"
show-overflow-tooltip>
<template v-slot:default="scope">
{{scope.row.passRate}}%
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.home.tested_case')"
show-overflow-tooltip>
<template v-slot:default="scope">
{{scope.row.tested}}/{{scope.row.total}}
</template>
</el-table-column>
<el-table-column
prop="projectName"
:label="$t('test_track.home.test_rate')"
min-width="100"
show-overflow-tooltip>
<template v-slot:default="scope">
<el-progress :percentage="scope.row.testRate"></el-progress>
</template>
</el-table-column>
<el-table-column
prop="stage"
:label="$t('test_track.plan.plan_stage')"
show-overflow-tooltip>
<template v-slot:default="scope">
<plan-stage-table-item :stage="scope.row.stage"/>
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="projectName"-->
<!-- :label="$t('test_track.plan.plan_project')"-->
<!-- show-overflow-tooltip>-->
<!-- </el-table-column>-->
</el-table>
</home-base-component>
</template>
<script>
import HomeBaseComponent from "./HomeBaseComponent";
import PlanStatusTableItem from "../../common/tableItems/plan/PlanStatusTableItem";
import PlanStageTableItem from "../../common/tableItems/plan/PlanStageTableItem";
import MsTableOperator from "../../../common/components/MsTableOperator";
import {getCurrentProjectID} from "../../../../../common/js/utils";
export default {
name: "RelatedTestPlanList",
components: {MsTableOperator, PlanStageTableItem, PlanStatusTableItem, HomeBaseComponent},
data() {
return {
result: {},
tableData: []
}
},
mounted() {
this.initTableData();
},
methods: {
initTableData() {
if (!getCurrentProjectID()) {
return;
}
this.result = this.$post('/test/plan/list/all/relate', {}, response => {
this.tableData = response.data;
// for (let i = 0; i < this.tableData.length; i++) {
// let path = "/test/plan/project/name/" + this.tableData[i].id;
// this.$get(path, res => {
// this.$set(this.tableData[i], "projectName", res.data);
// })
// }
});
},
intoPlan(row, event, column) {
this.$router.push('/track/plan/view/' + row.id);
}
}
}
</script>
<style scoped>
</style>