From 8ed6857960148c6460f16394db39e4086601a8e7 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 22 Dec 2020 20:02:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiDefinitionExecResultService.java | 26 +++++++++---------- .../api/automation/scenario/ApiComponent.vue | 10 ++++--- .../automation/scenario/Jsr233Processor.vue | 6 ++--- .../api/automation/scenario/MsInputTag.vue | 3 +-- .../components/case/ApiCaseItem.vue | 2 ++ .../components/list/ApiCaseSimpleList.vue | 2 +- .../definition/components/list/ApiList.vue | 2 ++ .../components/processor/Jsr233Processor.vue | 6 ++--- 8 files changed, 32 insertions(+), 25 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java index bdc2562abc..7c00ff765c 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiDefinitionExecResultService.java @@ -41,13 +41,13 @@ public class ApiDefinitionExecResultService { saveResult.setStartTime(item.getStartTime()); saveResult.setType(type); saveResult.setEndTime(item.getResponseResult().getResponseTime()); - saveResult.setStatus(item.getResponseResult().getResponseCode().equals("200") ? "success" : "error"); + saveResult.setStatus(item.isSuccess() ? "success" : "error"); apiDefinitionExecResultMapper.insert(saveResult); }); } public void deleteByResourceId(String resourceId) { - ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample(); + ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample(); example.createCriteria().andResourceIdEqualTo(resourceId); apiDefinitionExecResultMapper.deleteByExample(example); } @@ -64,10 +64,10 @@ public class ApiDefinitionExecResultService { Date firstTime = startAndEndDateInWeek.get("firstTime"); Date lastTime = startAndEndDateInWeek.get("lastTime"); - if(firstTime==null || lastTime == null){ - return 0; - }else { - return extApiDefinitionExecResultMapper.countByProjectIDAndCreateInThisWeek(projectId,firstTime.getTime(),lastTime.getTime()); + if (firstTime == null || lastTime == null) { + return 0; + } else { + return extApiDefinitionExecResultMapper.countByProjectIDAndCreateInThisWeek(projectId, firstTime.getTime(), lastTime.getTime()); } } @@ -79,18 +79,18 @@ public class ApiDefinitionExecResultService { public List findFaliureCaseInfoByProjectIDAndLimitNumberInSevenDays(String projectId, int limitNumber) { //获取7天之前的日期 - Date startDay = DateUtils.dateSum(new Date(),-6); + Date startDay = DateUtils.dateSum(new Date(), -6); //将日期转化为 00:00:00 的时间戳 Date startTime = null; - try{ + try { startTime = DateUtils.getDayStartTime(startDay); - }catch (Exception e){ + } catch (Exception e) { } - if(startTime==null){ - return new ArrayList<>(0); - }else { - return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId,startTime.getTime(),limitNumber); + if (startTime == null) { + return new ArrayList<>(0); + } else { + return extApiDefinitionExecResultMapper.findFaliureCaseInfoByProjectIDAndExecuteTimeAndLimitNumber(projectId, startTime.getTime(), limitNumber); } } } diff --git a/frontend/src/business/components/api/automation/scenario/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/ApiComponent.vue index 3e1dd54499..f982f29274 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiComponent.vue @@ -129,9 +129,13 @@ if (response.data) { Object.assign(this.request, JSON.parse(response.data.request)); this.request.name = response.data.name; - this.request.path = response.data.path; - this.request.method = response.data.method; - this.request.url = response.data.path; + if (response.data.path && response.data.path != null) { + this.request.path = response.data.path; + this.request.url = response.data.path; + } + if (response.data.method && response.data.method != null) { + this.request.method = response.data.method; + } this.request.requestResult = requestResult; this.request.id = response.data.id; this.reload(); diff --git a/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue b/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue index d0a346b054..2bd2ca58a6 100644 --- a/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue +++ b/frontend/src/business/components/api/automation/scenario/Jsr233Processor.vue @@ -31,7 +31,7 @@ @@ -94,10 +94,10 @@ ], isCodeEditAlive: true, languages: [ - 'java', "python" + 'beanshell', "python" ], codeEditModeMap: { - beanshell: 'java', + beanshell: 'beanshell', python: 'python' } } diff --git a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue index f9f5c26ff6..bee4e07e71 100644 --- a/frontend/src/business/components/api/automation/scenario/MsInputTag.vue +++ b/frontend/src/business/components/api/automation/scenario/MsInputTag.vue @@ -1,5 +1,5 @@