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 dc827b3246..f59bc8b5ca 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -319,8 +319,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); 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 >