Merge remote-tracking branch 'temp/master' into master

This commit is contained in:
BugKing 2020-09-24 16:09:59 +08:00
commit 5d17ed6348
6 changed files with 167 additions and 44 deletions

View File

@ -25,6 +25,14 @@ public class TestPlan implements Serializable {
private String executorMatchRule; private String executorMatchRule;
private Long plannedStartTime;
private Long plannedEndTime;
private Long actualStartTime;
private Long actualEndTime;
private Long createTime; private Long createTime;
private Long updateTime; private Long updateTime;

View File

@ -12,6 +12,10 @@
<result column="principal" jdbcType="VARCHAR" property="principal" /> <result column="principal" jdbcType="VARCHAR" property="principal" />
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" /> <result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" /> <result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
<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="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap> </resultMap>
@ -78,7 +82,7 @@
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule, id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time executor_match_rule, planned_start_time, planned_end_time, actual_start_time, actual_end_time, create_time, update_time
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
tags tags
@ -114,7 +118,7 @@
</if> </if>
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List" />
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List" />
@ -132,16 +136,16 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan"> <insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan (id, workspace_id, report_id, insert into test_plan (id, workspace_id, report_id,
`name`, description, `status`, `name`, description, `status`,
stage, principal, test_case_match_rule, stage, principal, test_case_match_rule,
executor_match_rule, create_time, update_time, executor_match_rule, planned_start_time, planned_end_time, create_time,
tags) update_time, tags)
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, #{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{executorMatchRule,jdbcType=VARCHAR}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
#{tags,jdbcType=LONGVARCHAR}) #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{tags,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
insert into test_plan insert into test_plan
@ -176,6 +180,12 @@
<if test="executorMatchRule != null"> <if test="executorMatchRule != null">
executor_match_rule, executor_match_rule,
</if> </if>
<if test="plannedStartTime != null">
planned_start_time,
</if>
<if test="plannedEndTime != null">
planned_end_time,
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
@ -217,6 +227,12 @@
<if test="executorMatchRule != null"> <if test="executorMatchRule != null">
#{executorMatchRule,jdbcType=VARCHAR}, #{executorMatchRule,jdbcType=VARCHAR},
</if> </if>
<if test="plannedStartTime != null">
#{plannedStartTime,jdbcType=BIGINT},
</if>
<if test="plannedEndTime != null">
#{plannedEndTime,jdbcType=BIGINT},
</if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT},
</if> </if>
@ -267,6 +283,18 @@
<if test="record.executorMatchRule != null"> <if test="record.executorMatchRule != null">
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
</if> </if>
<if test="record.plannedStartTime != null">
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
</if>
<if test="record.plannedEndTime != null">
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
</if>
<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.createTime != null"> <if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
</if> </if>
@ -284,18 +312,22 @@
<update id="updateByExampleWithBLOBs" parameterType="map"> <update id="updateByExampleWithBLOBs" parameterType="map">
update test_plan update test_plan
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR}, description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR}, stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR}, principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=LONGVARCHAR} actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
tags = #{record.tags,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -303,17 +335,21 @@
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update test_plan update test_plan
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR}, description = #{record.description,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
stage = #{record.stage,jdbcType=VARCHAR}, stage = #{record.stage,jdbcType=VARCHAR},
principal = #{record.principal,jdbcType=VARCHAR}, principal = #{record.principal,jdbcType=VARCHAR},
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT} planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -348,6 +384,18 @@
<if test="executorMatchRule != null"> <if test="executorMatchRule != null">
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
</if> </if>
<if test="plannedStartTime != null">
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
</if>
<if test="plannedEndTime != null">
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
</if>
<if test="actualStartTime != null">
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
</if>
<if test="actualEndTime != null">
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
</if> </if>
@ -371,6 +419,10 @@
principal = #{principal,jdbcType=VARCHAR}, principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
tags = #{tags,jdbcType=LONGVARCHAR} tags = #{tags,jdbcType=LONGVARCHAR}
@ -387,6 +439,10 @@
principal = #{principal,jdbcType=VARCHAR}, principal = #{principal,jdbcType=VARCHAR},
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT} update_time = #{updateTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}

View File

@ -95,6 +95,10 @@ public class TestPlanService {
testPlan.setId(testPlanId); testPlan.setId(testPlanId);
testPlan.setStatus(TestPlanStatus.Prepare.name()); testPlan.setStatus(TestPlanStatus.Prepare.name());
testPlan.setPlannedStartTime(System.currentTimeMillis());
testPlan.setPlannedEndTime(System.currentTimeMillis());
testPlan.setActualStartTime(System.currentTimeMillis());
testPlan.setActualEndTime(System.currentTimeMillis());
testPlan.setCreateTime(System.currentTimeMillis()); testPlan.setCreateTime(System.currentTimeMillis());
testPlan.setUpdateTime(System.currentTimeMillis()); testPlan.setUpdateTime(System.currentTimeMillis());
testPlanMapper.insert(testPlan); testPlanMapper.insert(testPlan);
@ -111,11 +115,20 @@ public class TestPlanService {
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan()); return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
} }
public int editTestPlan(TestPlanDTO testPlan) { public int editTestPlan(TestPlan testPlan) {
editTestPlanProject(testPlan);
testPlan.setUpdateTime(System.currentTimeMillis()); testPlan.setUpdateTime(System.currentTimeMillis());
checkTestPlanExist(testPlan); checkTestPlanExist(testPlan);
return testPlanMapper.updateByPrimaryKeySelective(testPlan); //进行中状态写入实际开始时间
if ("Underway".equals(testPlan.getStatus())) {
testPlan.setActualStartTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else if("Completed".equals(testPlan.getStatus())){
//已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis());
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
} else {
return 0;
}
} }
private void editTestPlanProject(TestPlanDTO testPlan) { private void editTestPlanProject(TestPlanDTO testPlan) {

View File

@ -69,6 +69,30 @@
</el-col> </el-col>
</el-row> </el-row>
<!--start:xuxm增加自定义计划开始计划结束时间字段-->
<el-row>
<el-col :span="8" :offset="1">
<el-form-item
:placeholder="$t('test_track.plan.planned_start_time')"
:label="$t('test_track.plan.planned_start_time')"
:label-width="formLabelWidth"
prop="plannedStartTime">
<el-input v-model="form.planned_start_time" type="date" ></el-input>
</el-form-item>
</el-col>
<el-col :span="11" :offset="2">
<el-form-item
:placeholder="$t('test_track.plan.planned_end_time')"
:label="$t('test_track.plan.planned_end_time')"
:label-width="formLabelWidth"
prop="planned_end_time">
<el-input v-model="form.planned_end_time" type="date" ></el-input>
</el-form-item>
</el-col>
</el-row>
<!--end:xuxm增加自定义计划开始计划结束时间字段-->
<el-row type="flex" justify="left" style="margin-top: 10px;"> <el-row type="flex" justify="left" style="margin-top: 10px;">
<el-col :span="23" :offset="1"> <el-col :span="23" :offset="1">
<el-form-item :label="$t('commons.description')" :label-width="formLabelWidth" prop="description"> <el-form-item :label="$t('commons.description')" :label-width="formLabelWidth" prop="description">

View File

@ -70,20 +70,38 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
sortable sortable
prop="createTime" prop="plannedStartTime"
:label="$t('commons.create_time')" :label="$t('test_track.plan.planned_start_time')"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span> <span>{{ scope.row.plannedStartTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
sortable sortable
prop="updateTime" prop="plannedEndTime"
:label="$t('commons.update_time')" :label="$t('test_track.plan.planned_end_time')"
show-overflow-tooltip> show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span> <span>{{ scope.row.plannedEndTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualStartTime"
:label="$t('test_track.plan.actual_start_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualStartTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column
sortable
prop="actualEndTime"
:label="$t('test_track.plan.actual_end_time')"
show-overflow-tooltip>
<template v-slot:default="scope">
<span>{{ scope.row.actualEndTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column

View File

@ -730,6 +730,10 @@ export default {
plan_status_prepare: "未开始", plan_status_prepare: "未开始",
plan_status_running: "进行中", plan_status_running: "进行中",
plan_status_completed: "已完成", plan_status_completed: "已完成",
planned_start_time: "计划开始",
planned_end_time: "计划结束",
actual_start_time: "实际开始",
actual_end_time: "实际结束",
plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ", plan_delete_confirm: "将删除该测试计划下所有用例,确认删除测试计划: ",
plan_delete: "删除计划", plan_delete: "删除计划",
}, },