fix: 脑图创建的用例导出状态和责任人为空

--bug=1008870 --user=陈建星 【测试跟踪】接口用例导出,没有导出用例状态和责任人 https://www.tapd.cn/55049933/s/1092842
This commit is contained in:
chenjianxing 2022-01-17 15:04:32 +08:00 committed by jianxing
parent 5197231bca
commit c44af2f3d1
3 changed files with 8 additions and 22 deletions

View File

@ -62,7 +62,6 @@ import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionUtils; import org.mybatis.spring.SqlSessionUtils;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -1092,12 +1091,7 @@ public class TestCaseService {
boolean importFileNeedNum = true; boolean importFileNeedNum = true;
TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class); TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class);
TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId()); TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId());
List<CustomFieldDao> customFields = null; List<CustomFieldDao> customFields = Optional.ofNullable(testCaseTemplate.getCustomFields()).orElse(new ArrayList<>());
if (testCaseTemplate == null) {
customFields = new ArrayList<>();
} else {
customFields = testCaseTemplate.getCustomFields();
}
List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields); List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields);
List<List<Object>> testCaseDataByExcelList = this.generateTestCaseExcel(headList, datas); List<List<Object>> testCaseDataByExcelList = this.generateTestCaseExcel(headList, datas);
@ -1173,10 +1167,8 @@ public class TestCaseService {
for (TestCaseExcelData model : datas) { for (TestCaseExcelData model : datas) {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
Map<String, String> customDataMaps = model.getCustomDatas(); Map<String,String> customDataMaps = Optional.ofNullable(model.getCustomDatas()).orElse(new HashMap<>());
if (customDataMaps == null) {
customDataMaps = new HashMap<>();
}
for (String head : headList) { for (String head : headList) {
if (StringUtils.equalsAnyIgnoreCase(head, "ID")) { if (StringUtils.equalsAnyIgnoreCase(head, "ID")) {
list.add(model.getCustomNum()); list.add(model.getCustomNum());
@ -1208,17 +1200,12 @@ public class TestCaseService {
list.add(model.getStepModel()); list.add(model.getStepModel());
} else if (StringUtils.equalsAnyIgnoreCase(head, "Priority", "用例等級", "用例等级")) { } else if (StringUtils.equalsAnyIgnoreCase(head, "Priority", "用例等級", "用例等级")) {
list.add(model.getPriority()); list.add(model.getPriority());
// }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){ } else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){
// list.add(model.getStatus()); list.add(model.getStatus());
} else if (StringUtils.equalsAnyIgnoreCase(head, "Maintainer(ID)", "责任人(ID)", "維護人(ID)")) { } else if (StringUtils.equalsAnyIgnoreCase(head, "Maintainer(ID)", "责任人(ID)", "維護人(ID)")) {
String value = customDataMaps.get("责任人"); list.add(model.getMaintainer());
value = value == null ? "" : value;
list.add(value);
} else { } else {
String value = customDataMaps.get(head); String value = Optional.ofNullable(customDataMaps.get(head)).orElse("");
if (value == null) {
value = "";
}
list.add(value); list.add(value);
} }
} }

View File

@ -54,7 +54,7 @@
"vue-float-action-button": "^0.6.6", "vue-float-action-button": "^0.6.6",
"vue-i18n": "^8.15.3", "vue-i18n": "^8.15.3",
"vue-jsonpath-picker": "^1.1.5", "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-papa-parse": "^2.0.0",
"vue-pdf": "^4.2.0", "vue-pdf": "^4.2.0",
"vue-router": "^3.1.3", "vue-router": "^3.1.3",

View File

@ -40,7 +40,6 @@ import {getTestCasesForMinder, getMinderExtraNode} from "@/network/testCase";
import {addIssueHotBox, getSelectedNodeData, handleIssueAdd, handleIssueBatch} from "./minderUtils"; import {addIssueHotBox, getSelectedNodeData, handleIssueAdd, handleIssueBatch} from "./minderUtils";
import IssueRelateList from "@/business/components/track/case/components/IssueRelateList"; import IssueRelateList from "@/business/components/track/case/components/IssueRelateList";
import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit"; import TestPlanIssueEdit from "@/business/components/track/case/components/TestPlanIssueEdit";
import {getIssuesById} from "@/network/Issue";
const {getIssuesListById} = require("@/network/Issue"); const {getIssuesListById} = require("@/network/Issue");
const {getCurrentWorkspaceId} = require("@/common/js/utils"); const {getCurrentWorkspaceId} = require("@/common/js/utils");