fix(测试计划): 修复归档模式下测试计划状态自动统计算法的缺陷
--bug=1042760 --user=宋天阳 【测试计划】计划组列表-删除已归档子计划-计划组状态更新为未开始 https://www.tapd.cn/55049933/s/1533068
This commit is contained in:
parent
89915f4064
commit
363b668b05
|
@ -154,7 +154,8 @@ public class OperationLogModule {
|
||||||
public static final String BUG_MANAGEMENT_RECYCLE = "BUG_MANAGEMENT_BUG_RECYCLE";
|
public static final String BUG_MANAGEMENT_RECYCLE = "BUG_MANAGEMENT_BUG_RECYCLE";
|
||||||
//测试计划
|
//测试计划
|
||||||
public static final String TEST_PLAN = "TEST_PLAN";
|
public static final String TEST_PLAN = "TEST_PLAN";
|
||||||
public static final String TEST_PLAN_INDEX = "TEST_PLAN_INDEX";
|
public static final String TEST_PLAN_TEST_PLAN = "TEST_PLAN_PLAN";
|
||||||
|
public static final String TEST_PLAN_TEST_PLAN_GROUP = "TEST_PLAN_GROUP";
|
||||||
public static final String TEST_PLAN_MODULE = "TEST_PLAN_MODULE";
|
public static final String TEST_PLAN_MODULE = "TEST_PLAN_MODULE";
|
||||||
public static final String TEST_PLAN_REPORT = "TEST_PLAN_REPORT_TEST_PLAN";
|
public static final String TEST_PLAN_REPORT = "TEST_PLAN_REPORT_TEST_PLAN";
|
||||||
public static final String TEST_PLAN_GROUP_REPORT = "TEST_PLAN_REPORT_TEST_PLAN_GROUP";
|
public static final String TEST_PLAN_GROUP_REPORT = "TEST_PLAN_REPORT_TEST_PLAN_GROUP";
|
||||||
|
|
|
@ -53,6 +53,12 @@
|
||||||
and tpc.test_plan_id = #{testPlanId}
|
and tpc.test_plan_id = #{testPlanId}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectDefaultCollectionId" resultType="java.lang.String">
|
<select id="selectDefaultCollectionId" resultType="java.lang.String">
|
||||||
SELECT id FROM test_plan_collection WHERE test_plan_id = #{testPlanId} AND parent_id!='NONE' and type = #{type}
|
SELECT id
|
||||||
|
FROM test_plan_collection
|
||||||
|
WHERE test_plan_id = #{testPlanId}
|
||||||
|
AND parent_id != 'NONE'
|
||||||
|
and type = #{type}
|
||||||
|
ORDER BY pos
|
||||||
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -170,7 +170,7 @@ public class TestPlanBatchOperationService extends TestPlanBaseUtilsService {
|
||||||
throw new MSException(Translator.get("test_plan.group.error"));
|
throw new MSException(Translator.get("test_plan.group.error"));
|
||||||
}
|
}
|
||||||
pos = testPlanGroupService.getNextOrder(targetId);
|
pos = testPlanGroupService.getNextOrder(targetId);
|
||||||
moduleId = group.getId();
|
moduleId = group.getModuleId();
|
||||||
}
|
}
|
||||||
groupId = targetId;
|
groupId = targetId;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import io.metersphere.plan.mapper.TestPlanMapper;
|
||||||
import io.metersphere.project.domain.Project;
|
import io.metersphere.project.domain.Project;
|
||||||
import io.metersphere.project.mapper.ProjectMapper;
|
import io.metersphere.project.mapper.ProjectMapper;
|
||||||
import io.metersphere.sdk.constants.HttpMethodConstants;
|
import io.metersphere.sdk.constants.HttpMethodConstants;
|
||||||
|
import io.metersphere.sdk.constants.TestPlanConstants;
|
||||||
import io.metersphere.sdk.util.JSON;
|
import io.metersphere.sdk.util.JSON;
|
||||||
import io.metersphere.sdk.util.Translator;
|
import io.metersphere.sdk.util.Translator;
|
||||||
import io.metersphere.system.dto.LogInsertModule;
|
import io.metersphere.system.dto.LogInsertModule;
|
||||||
|
@ -30,7 +31,6 @@ import java.util.stream.Collectors;
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class TestPlanLogService {
|
public class TestPlanLogService {
|
||||||
|
|
||||||
private String logModule = OperationLogModule.TEST_PLAN_INDEX;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ProjectMapper projectMapper;
|
private ProjectMapper projectMapper;
|
||||||
|
@ -46,7 +46,7 @@ public class TestPlanLogService {
|
||||||
.projectId(project.getId())
|
.projectId(project.getId())
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(OperationLogType.UPDATE.name())
|
.type(OperationLogType.UPDATE.name())
|
||||||
.module(logModule)
|
.module(getLogModule(testPlan))
|
||||||
.sourceId(testPlan.getId())
|
.sourceId(testPlan.getId())
|
||||||
.content(Translator.get("test_plan_schedule") + ":" + testPlan.getName())
|
.content(Translator.get("test_plan_schedule") + ":" + testPlan.getName())
|
||||||
.build().getLogDTO();
|
.build().getLogDTO();
|
||||||
|
@ -67,7 +67,7 @@ public class TestPlanLogService {
|
||||||
.projectId(module.getProjectId())
|
.projectId(module.getProjectId())
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(OperationLogType.ADD.name())
|
.type(OperationLogType.ADD.name())
|
||||||
.module(logModule)
|
.module(getLogModule(module))
|
||||||
.method(requestMethod)
|
.method(requestMethod)
|
||||||
.path(requestUrl)
|
.path(requestUrl)
|
||||||
.sourceId(module.getId())
|
.sourceId(module.getId())
|
||||||
|
@ -94,7 +94,7 @@ public class TestPlanLogService {
|
||||||
.projectId(projectId)
|
.projectId(projectId)
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(OperationLogType.UPDATE.name())
|
.type(OperationLogType.UPDATE.name())
|
||||||
.module(logModule)
|
.module(getLogModule(newTestPlan))
|
||||||
.method(requestMethod)
|
.method(requestMethod)
|
||||||
.path(requestUrl)
|
.path(requestUrl)
|
||||||
.sourceId(newTestPlan.getId())
|
.sourceId(newTestPlan.getId())
|
||||||
|
@ -120,7 +120,7 @@ public class TestPlanLogService {
|
||||||
.projectId(deleteTestPlan.getProjectId())
|
.projectId(deleteTestPlan.getProjectId())
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(OperationLogType.DELETE.name())
|
.type(OperationLogType.DELETE.name())
|
||||||
.module(logModule)
|
.module(getLogModule(deleteTestPlan))
|
||||||
.method(requestMethod)
|
.method(requestMethod)
|
||||||
.path(requestUrl)
|
.path(requestUrl)
|
||||||
.sourceId(deleteTestPlan.getId())
|
.sourceId(deleteTestPlan.getId())
|
||||||
|
@ -145,7 +145,7 @@ public class TestPlanLogService {
|
||||||
testPlan.getId(),
|
testPlan.getId(),
|
||||||
null,
|
null,
|
||||||
OperationLogType.ARCHIVED.name(),
|
OperationLogType.ARCHIVED.name(),
|
||||||
logModule,
|
getLogModule(testPlan),
|
||||||
testPlan.getName());
|
testPlan.getName());
|
||||||
dto.setPath("/test-plan/archived");
|
dto.setPath("/test-plan/archived");
|
||||||
dto.setMethod(HttpMethodConstants.GET.name());
|
dto.setMethod(HttpMethodConstants.GET.name());
|
||||||
|
@ -164,8 +164,8 @@ public class TestPlanLogService {
|
||||||
project.getOrganizationId(),
|
project.getOrganizationId(),
|
||||||
testPlan.getId(),
|
testPlan.getId(),
|
||||||
operator,
|
operator,
|
||||||
OperationLogType.COPY.name(),
|
OperationLogType.ADD.name(),
|
||||||
logModule,
|
getLogModule(testPlan),
|
||||||
testPlan.getName());
|
testPlan.getName());
|
||||||
dto.setPath("/test-plan/copy");
|
dto.setPath("/test-plan/copy");
|
||||||
dto.setMethod(HttpMethodConstants.POST.name());
|
dto.setMethod(HttpMethodConstants.POST.name());
|
||||||
|
@ -192,7 +192,7 @@ public class TestPlanLogService {
|
||||||
.projectId(plan.getProjectId())
|
.projectId(plan.getProjectId())
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(requestType)
|
.type(requestType)
|
||||||
.module(logModule)
|
.module(getLogModule(plan))
|
||||||
.method(requestMethod)
|
.method(requestMethod)
|
||||||
.path(requestUrl)
|
.path(requestUrl)
|
||||||
.sourceId(plan.getId())
|
.sourceId(plan.getId())
|
||||||
|
@ -228,7 +228,7 @@ public class TestPlanLogService {
|
||||||
testPlan.getId(),
|
testPlan.getId(),
|
||||||
null,
|
null,
|
||||||
OperationLogType.UPDATE.name(),
|
OperationLogType.UPDATE.name(),
|
||||||
logModule,
|
getLogModule(testPlan),
|
||||||
testPlan.getName());
|
testPlan.getName());
|
||||||
dto.setPath("/test-plan/batch-edit");
|
dto.setPath("/test-plan/batch-edit");
|
||||||
dto.setMethod(HttpMethodConstants.POST.name());
|
dto.setMethod(HttpMethodConstants.POST.name());
|
||||||
|
@ -246,7 +246,7 @@ public class TestPlanLogService {
|
||||||
.projectId(testPlan.getProjectId())
|
.projectId(testPlan.getProjectId())
|
||||||
.organizationId(project.getOrganizationId())
|
.organizationId(project.getOrganizationId())
|
||||||
.type(OperationLogType.UPDATE.name())
|
.type(OperationLogType.UPDATE.name())
|
||||||
.module(logModule)
|
.module(getLogModule(testPlan))
|
||||||
.method(logInsertModule.getRequestMethod())
|
.method(logInsertModule.getRequestMethod())
|
||||||
.path(logInsertModule.getRequestUrl())
|
.path(logInsertModule.getRequestUrl())
|
||||||
.sourceId(moveId)
|
.sourceId(moveId)
|
||||||
|
@ -256,4 +256,11 @@ public class TestPlanLogService {
|
||||||
operationLogService.add(dto);
|
operationLogService.add(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getLogModule(TestPlan testPlan) {
|
||||||
|
if (StringUtils.equalsIgnoreCase(testPlan.getStatus(), TestPlanConstants.TEST_PLAN_TYPE_PLAN)) {
|
||||||
|
return OperationLogModule.TEST_PLAN_TEST_PLAN;
|
||||||
|
} else {
|
||||||
|
return OperationLogModule.TEST_PLAN_TEST_PLAN_GROUP;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -840,10 +840,11 @@ public class TestPlanService extends TestPlanBaseUtilsService {
|
||||||
groupStatus = TestPlanConstants.TEST_PLAN_STATUS_UNDERWAY;
|
groupStatus = TestPlanConstants.TEST_PLAN_STATUS_UNDERWAY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TestPlanExample testPlanExample = new TestPlanExample();
|
||||||
|
testPlanExample.createCriteria().andIdEqualTo(testPlanGroupId).andStatusNotEqualTo(TestPlanConstants.TEST_PLAN_STATUS_ARCHIVED);
|
||||||
TestPlan updateGroupPlan = new TestPlan();
|
TestPlan updateGroupPlan = new TestPlan();
|
||||||
updateGroupPlan.setId(testPlanGroupId);
|
|
||||||
updateGroupPlan.setStatus(groupStatus);
|
updateGroupPlan.setStatus(groupStatus);
|
||||||
testPlanMapper.updateByPrimaryKeySelective(updateGroupPlan);
|
testPlanMapper.updateByExampleSelective(updateGroupPlan, testPlanExample);
|
||||||
if (StringUtils.equalsIgnoreCase(updateGroupPlan.getStatus(), TestPlanConstants.TEST_PLAN_STATUS_COMPLETED)) {
|
if (StringUtils.equalsIgnoreCase(updateGroupPlan.getStatus(), TestPlanConstants.TEST_PLAN_STATUS_COMPLETED)) {
|
||||||
extTestPlanMapper.setActualEndTime(testPlanGroupId, System.currentTimeMillis());
|
extTestPlanMapper.setActualEndTime(testPlanGroupId, System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue