fit: 解决冲突

This commit is contained in:
Coooder-X 2021-02-03 11:19:39 +08:00 committed by chenjianxing
parent 9a9f8f628b
commit 21f8e54069
2 changed files with 24 additions and 28 deletions

View File

@ -39,7 +39,6 @@ import io.metersphere.track.request.testplan.LoadCaseRequest;
import io.metersphere.track.request.testplan.RunTestPlanRequest;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.ExecutorType;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
@ -171,33 +170,30 @@ public class TestPlanService {
checkTestPlanExist(testPlan);
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
if (!res.getStatus().equals(testPlan.getStatus())) { // 若有改变才更新时间
res.setUpdateTime(System.currentTimeMillis());
testPlan.setUpdateTime(System.currentTimeMillis());
if (TestPlanStatus.Underway.name().equals(testPlan.getStatus())) {
if (res.getStatus().equals(TestPlanStatus.Prepare.name())) {
res.setActualStartTime(System.currentTimeMillis());
testPlan.setActualStartTime(System.currentTimeMillis());
} // 未开始->进行中写入实际开始时间
else if (res.getStatus().equals(TestPlanStatus.Completed.name())) {
res.setActualEndTime(null);
testPlan.setActualEndTime(null);
} // 已完成->进行中结束时间置空
} else if (!StringUtils.equals(res.getStatus(), TestPlanStatus.Prepare.name()) &&
StringUtils.equals(testPlan.getStatus(), TestPlanStatus.Prepare.name())) {
res.setActualStartTime(null);
res.setActualEndTime(null);
} else if (!res.getStatus().equals(TestPlanStatus.Prepare.name()) &&
testPlan.getStatus().equals(TestPlanStatus.Prepare.name())) {
testPlan.setActualStartTime(null);
testPlan.setActualEndTime(null);
} // 非未开始->未开始时间都置空
else if (TestPlanStatus.Completed.name().equals(testPlan.getStatus()) &&
!TestPlanStatus.Completed.name().equals(res.getStatus())) {
//已完成写入实际完成时间
res.setActualEndTime(System.currentTimeMillis());
}
if(StringUtils.isNotEmpty(testPlan.getStatus())){
res.setStatus(testPlan.getStatus());
testPlan.setActualEndTime(System.currentTimeMillis());
}
}
List<String> userIds = new ArrayList<>();
userIds.add(testPlan.getPrincipal());
AddTestPlanRequest testPlans = new AddTestPlanRequest();
int i = testPlanMapper.updateByPrimaryKey(res); // 更新
int i = testPlanMapper.updateByPrimaryKey(testPlan); // 更新
if (!StringUtils.isBlank(testPlan.getStatus())) {
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
String context = getTestPlanContext(testPlans, NoticeConstants.Event.UPDATE);

View File

@ -63,23 +63,23 @@
</template>
<script>
import MsAssertionResults from "./AssertionResults";
import MsCodeEdit from "../MsCodeEdit";
import MsDropdown from "../../../../common/components/MsDropdown";
import {BODY_FORMAT} from "../../model/ApiTestModel";
import MsSqlResultTable from "./SqlResultTable";
import MsAssertionResults from "./AssertionResults";
import MsCodeEdit from "../MsCodeEdit";
import MsDropdown from "../../../../common/components/MsDropdown";
import {BODY_FORMAT} from "../../model/ApiTestModel";
import MsSqlResultTable from "./SqlResultTable";
export default {
name: "MsResponseResult",
export default {
name: "MsResponseResult",
components: {
MsDropdown,
MsCodeEdit,
MsAssertionResults,
MsSqlResultTable
},
components: {
MsDropdown,
MsCodeEdit,
MsAssertionResults,
MsSqlResultTable
},
props: {
props: {
response: Object,
currentProtocol: String,
},
@ -107,7 +107,7 @@
this.mode = mode;
},
setBodyType() {
if (!this.response.responseResult.headers) {
if (!this.response.responseResult || !this.response.responseResult.headers) {
return;
}
if (this.response.responseResult.headers.indexOf("Content-Type: application/json") > 0) {