fix(测试计划): #1006818 【测试计划】-执行性能测试,在报告页面删掉该测试,测试计划里面的执行状态未更新、保存TCP出错

【【测试计划】-执行性能测试,在报告页面删掉该测试,测试计划里面的执行状态未更新】https://www.tapd.cn/55049933/bugtrace/bugs/view?bug_id=1155049933001006818;保存TCP接口出错的问题
This commit is contained in:
song-tianyang 2021-09-22 15:40:33 +08:00 committed by song-tianyang
parent 0963ee55b6
commit 16d77897b3
7 changed files with 58 additions and 24 deletions

View File

@ -35,4 +35,8 @@ public interface ExtTestPlanLoadCaseMapper {
Long getPreOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("planId")String planId, @Param("baseOrder") Long baseOrder);
List<String> selectIdByLoadCaseReportIdAndStatusIsRun(String reportId);
void updateStatusNullById(String id);
}

View File

@ -312,4 +312,13 @@
order by `order` desc limit 1;
</select>
<select id="selectIdByLoadCaseReportIdAndStatusIsRun" resultType="java.lang.String">
select `id` from test_plan_load_case where load_report_id = #{planId}
and `status` = 'run'
</select>
<update id="updateStatusNullById">
update test_plan_load_case tplc
set status = null
where id = #{0}
</update>
</mapper>

View File

@ -9,6 +9,7 @@ import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper;
import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.ReportKeys;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.controller.request.OrderRequest;
@ -28,6 +29,7 @@ import io.metersphere.performance.engine.Engine;
import io.metersphere.performance.engine.EngineFactory;
import io.metersphere.service.FileService;
import io.metersphere.service.TestResourceService;
import io.metersphere.track.service.TestPlanLoadCaseService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
@ -145,6 +147,9 @@ public class PerformanceReportService {
// delete jtl file
fileService.deleteFileById(loadTestReport.getFileId());
//check test_plan_load_case status
TestPlanLoadCaseService testPlanLoadCaseService = CommonBeanFactory.getBean(TestPlanLoadCaseService.class);
testPlanLoadCaseService.checkStatusByDeleteLoadCaseReportId(reportId);
loadTestReportMapper.deleteByPrimaryKey(reportId);
}

View File

@ -418,4 +418,12 @@ public class TestPlanLoadCaseService {
testPlanLoadCaseMapper::updateByPrimaryKeySelective);
}
public void checkStatusByDeleteLoadCaseReportId(String reportId) {
List<String> updatedId = extTestPlanLoadCaseMapper.selectIdByLoadCaseReportIdAndStatusIsRun(reportId);
if(CollectionUtils.isNotEmpty(updatedId)){
for (String id : updatedId) {
extTestPlanLoadCaseMapper.updateStatusNullById(id);
}
}
}
}

View File

@ -172,7 +172,9 @@ export default {
this.basisData.backScript = JSON.stringify(this.request.backScript);
}
}else{
this.$refs.tcpFormatParameter.validateXmlDataStruct();
if(this.$refs.tcpFormatParameter){
this.$refs.tcpFormatParameter.validateXmlDataStruct();
}
}
this.$emit('saveApi', this.basisData);
}
@ -200,7 +202,9 @@ export default {
this.basisData.backScript = JSON.stringify(this.request.backScript);
}
}else{
this.$refs.tcpFormatParameter.validateXmlDataStruct();
if(this.$refs.tcpFormatParameter){
this.$refs.tcpFormatParameter.validateXmlDataStruct();
}
}
this.$emit('runTest', this.basisData);
}

View File

@ -405,19 +405,21 @@
},
checkXmlTableDataStructData(dataStruct){
let allCheckResult = true;
if(dataStruct && dataStruct.length > 0){
for(let i = 0;i<dataStruct.length;i++){
let row = dataStruct[i];
allCheckResult = this.$refs.treeTable.validateRowData(row);
if(allCheckResult){
if(row.children != null && row.children.length > 0){
allCheckResult = this.checkXmlTableDataStructData(row.children);
if(!allCheckResult){
return false;
if(this.$refs.treeTable){
if(dataStruct && dataStruct.length > 0){
for(let i = 0;i<dataStruct.length;i++){
let row = dataStruct[i];
allCheckResult = this.$refs.treeTable.validateRowData(row);
if(allCheckResult){
if(row.children != null && row.children.length > 0){
allCheckResult = this.checkXmlTableDataStructData(row.children);
if(!allCheckResult){
return false;
}
}
}else{
return false;
}
}else{
return false;
}
}
}

View File

@ -169,19 +169,21 @@ export default {
},
checkXmlTableDataStructData(dataStruct){
let allCheckResult = true;
if(dataStruct && dataStruct.length > 0){
for(let i = 0;i<dataStruct.length;i++){
let row = dataStruct[i];
allCheckResult = this.$refs.treeTable.validateRowData(row);
if(allCheckResult){
if(row.children != null && row.children.length > 0){
allCheckResult = this.checkXmlTableDataStructData(row.children);
if(!allCheckResult){
return false;
if(this.$refs.treeTable){
if(dataStruct && dataStruct.length > 0){
for(let i = 0;i<dataStruct.length;i++){
let row = dataStruct[i];
allCheckResult = this.$refs.treeTable.validateRowData(row);
if(allCheckResult){
if(row.children != null && row.children.length > 0){
allCheckResult = this.checkXmlTableDataStructData(row.children);
if(!allCheckResult){
return false;
}
}
}else{
return false;
}
}else{
return false;
}
}
}