From 9b1ff67b7f1fcc668441b97b3dd885ba4bccadad Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Mon, 12 Oct 2020 16:03:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E8=A1=A8=E5=A4=B4=E6=8F=90=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/excel/listener/EasyExcelListener.java | 7 +------ .../metersphere/excel/listener/TestCaseDataListener.java | 6 ++++-- .../java/io/metersphere/track/service/TestCaseService.java | 5 +++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java b/backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java index 77ce4d66f4..85f6dc31f6 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/EasyExcelListener.java @@ -29,12 +29,7 @@ public abstract class EasyExcelListener extends AnalysisEventListener { */ protected static final int BATCH_COUNT = 2000; - protected Class clazz; - - public EasyExcelListener() { - Type type = getClass().getGenericSuperclass(); - this.clazz = (Class) ((ParameterizedType) type).getActualTypeArguments()[0]; - } + protected Class clazz; /** * 每条数据解析都会调用 diff --git a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java index d4d590586d..1dff285527 100644 --- a/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java +++ b/backend/src/main/java/io/metersphere/excel/listener/TestCaseDataListener.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import io.metersphere.base.domain.TestCaseWithBLOBs; import io.metersphere.commons.constants.TestCaseConstants; import io.metersphere.commons.utils.BeanUtils; +import io.metersphere.commons.utils.CommonBeanFactory; import io.metersphere.excel.domain.TestCaseExcelData; import io.metersphere.i18n.Translator; import io.metersphere.track.service.TestCaseService; @@ -25,8 +26,9 @@ public class TestCaseDataListener extends EasyExcelListener { Set userIds; - public TestCaseDataListener(TestCaseService testCaseService, String projectId, Set testCaseNames, Set userIds) { - this.testCaseService = testCaseService; + public TestCaseDataListener(Class clazz, String projectId, Set testCaseNames, Set userIds) { + this.clazz = clazz; + this.testCaseService = (TestCaseService) CommonBeanFactory.getBean("testCaseService"); this.projectId = projectId; this.testCaseNames = testCaseNames; this.userIds = userIds; 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 156dc23ca8..f168a2cf07 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -317,8 +317,9 @@ public class TestCaseService { Set userIds = userRoleMapper.selectByExample(userRoleExample).stream().map(UserRole::getUserId).collect(Collectors.toSet()); try { - EasyExcelListener easyExcelListener = new TestCaseDataListener(this, projectId, testCaseNames, userIds); - EasyExcelFactory.read(multipartFile.getInputStream(), new TestCaseExcelDataFactory().getExcelDataByLocal(), easyExcelListener).sheet().doRead(); + Class clazz = new TestCaseExcelDataFactory().getExcelDataByLocal(); + EasyExcelListener easyExcelListener = new TestCaseDataListener(clazz, projectId, testCaseNames, userIds); + EasyExcelFactory.read(multipartFile.getInputStream(), clazz, easyExcelListener).sheet().doRead(); errList = easyExcelListener.getErrList(); } catch (Exception e) { LogUtil.error(e.getMessage(), e); From 3f8e5c58d318303434889b1f81cb666a6eef0cd4 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Mon, 12 Oct 2020 18:06:17 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../track/case/components/TestCaseDetail.vue | 201 ++++++++++++++++++ .../track/case/components/TestCaseList.vue | 18 +- 2 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 frontend/src/business/components/track/case/components/TestCaseDetail.vue diff --git a/frontend/src/business/components/track/case/components/TestCaseDetail.vue b/frontend/src/business/components/track/case/components/TestCaseDetail.vue new file mode 100644 index 0000000000..94aadc184f --- /dev/null +++ b/frontend/src/business/components/track/case/components/TestCaseDetail.vue @@ -0,0 +1,201 @@ + + + + + diff --git a/frontend/src/business/components/track/case/components/TestCaseList.vue b/frontend/src/business/components/track/case/components/TestCaseList.vue index 94b9b5c67e..8b9fb910ec 100644 --- a/frontend/src/business/components/track/case/components/TestCaseList.vue +++ b/frontend/src/business/components/track/case/components/TestCaseList.vue @@ -56,9 +56,18 @@ show-overflow-tooltip >