From c44af2f3d187739b772fd9be3b957fc52e0283fd Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 17 Jan 2022 15:04:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=84=91=E5=9B=BE=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=87=BA=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=92=8C=E8=B4=A3=E4=BB=BB=E4=BA=BA=E4=B8=BA=E7=A9=BA=20--bug?= =?UTF-8?q?=3D1008870=20--user=3D=E9=99=88=E5=BB=BA=E6=98=9F=20=E3=80=90?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA=E3=80=91=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=87=BA=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E7=94=A8=E4=BE=8B=E7=8A=B6=E6=80=81=E5=92=8C?= =?UTF-8?q?=E8=B4=A3=E4=BB=BB=E4=BA=BA=20https://www.tapd.cn/55049933/s/10?= =?UTF-8?q?92842?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/service/TestCaseService.java | 27 +++++-------------- frontend/package.json | 2 +- .../track/common/minder/TestCaseMinder.vue | 1 - 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 547fddd52b..090f1bd54c 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -62,7 +62,6 @@ import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.mybatis.spring.SqlSessionUtils; import org.springframework.context.annotation.Lazy; -import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -1092,12 +1091,7 @@ public class TestCaseService { boolean importFileNeedNum = true; TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class); TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId()); - List customFields = null; - if (testCaseTemplate == null) { - customFields = new ArrayList<>(); - } else { - customFields = testCaseTemplate.getCustomFields(); - } + List customFields = Optional.ofNullable(testCaseTemplate.getCustomFields()).orElse(new ArrayList<>()); List> headList = testCaseExcelData.getHead(importFileNeedNum, customFields); List> testCaseDataByExcelList = this.generateTestCaseExcel(headList, datas); @@ -1173,10 +1167,8 @@ public class TestCaseService { for (TestCaseExcelData model : datas) { List list = new ArrayList<>(); - Map customDataMaps = model.getCustomDatas(); - if (customDataMaps == null) { - customDataMaps = new HashMap<>(); - } + Map customDataMaps = Optional.ofNullable(model.getCustomDatas()).orElse(new HashMap<>()); + for (String head : headList) { if (StringUtils.equalsAnyIgnoreCase(head, "ID")) { list.add(model.getCustomNum()); @@ -1208,17 +1200,12 @@ public class TestCaseService { list.add(model.getStepModel()); } else if (StringUtils.equalsAnyIgnoreCase(head, "Priority", "用例等級", "用例等级")) { list.add(model.getPriority()); -// }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){ -// list.add(model.getStatus()); + } else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){ + list.add(model.getStatus()); } else if (StringUtils.equalsAnyIgnoreCase(head, "Maintainer(ID)", "责任人(ID)", "維護人(ID)")) { - String value = customDataMaps.get("责任人"); - value = value == null ? "" : value; - list.add(value); + list.add(model.getMaintainer()); } else { - String value = customDataMaps.get(head); - if (value == null) { - value = ""; - } + String value = Optional.ofNullable(customDataMaps.get(head)).orElse(""); list.add(value); } } diff --git a/frontend/package.json b/frontend/package.json index db7f91e14e..3f513cb04b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -54,7 +54,7 @@ "vue-float-action-button": "^0.6.6", "vue-i18n": "^8.15.3", "vue-jsonpath-picker": "^1.1.5", - "vue-minder-editor-plus": "1.0.40", + "vue-minder-editor-plus": "1.0.41", "vue-papa-parse": "^2.0.0", "vue-pdf": "^4.2.0", "vue-router": "^3.1.3", diff --git a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue index 523b45b874..c90c0df551 100644 --- a/frontend/src/business/components/track/common/minder/TestCaseMinder.vue +++ b/frontend/src/business/components/track/common/minder/TestCaseMinder.vue @@ -40,7 +40,6 @@ import {getTestCasesForMinder, getMinderExtraNode} from "@/network/testCase"; import {addIssueHotBox, getSelectedNodeData, handleIssueAdd, handleIssueBatch} from "./minderUtils"; import IssueRelateList from "@/business/components/track/case/components/IssueRelateList"; import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit"; -import {getIssuesById} from "@/network/Issue"; const {getIssuesListById} = require("@/network/Issue"); const {getCurrentWorkspaceId} = require("@/common/js/utils");