diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseImportEventListener.java b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseImportEventListener.java index edc8e83389..7a67772ec4 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseImportEventListener.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/excel/listener/FunctionalCaseImportEventListener.java @@ -66,9 +66,9 @@ public class FunctionalCaseImportEventListener extends AnalysisEventListener list = new ArrayList<>(); protected List> errList = new ArrayList<>(); /** diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml index fc1988b605..1800f4c07d 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtCaseReviewHistoryMapper.xml @@ -105,12 +105,15 @@ update case_review_history set abandoned = true - where review_id = #{reviewId} + where abandoned = false + + and review_id = #{reviewId} + and case_id in #{caseId} - and abandoned = false + diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java index 768dd23f76..f3def27772 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/CaseReviewFunctionalCaseService.java @@ -335,10 +335,10 @@ public class CaseReviewFunctionalCaseService { if (CollectionUtils.isNotEmpty(caseReviewFunctionalCases)) { //重新提审,作废之前的记录 extCaseReviewHistoryMapper.updateAbandoned(blob.getId()); - + List historyList = new ArrayList<>(); caseReviewFunctionalCases.forEach(item -> { updateReviewCaseAndCaseStatus(item); - insertHistory(item); + insertHistory(item, historyList); //更新用例触发重新提审-需要重新计算评审的整体状态 Map countMap = new HashMap<>(); countMap.put(item.getStatus(), 1); @@ -354,10 +354,11 @@ public class CaseReviewFunctionalCaseService { provider.updateCaseReview(param); }); + caseReviewHistoryMapper.batchInsertSelective(historyList); } } - private void insertHistory(CaseReviewFunctionalCase item) { + private void insertHistory(CaseReviewFunctionalCase item, List historyList) { CaseReviewHistory caseReviewHistory = new CaseReviewHistory(); caseReviewHistory.setId(IDGenerator.nextStr()); caseReviewHistory.setCaseId(item.getCaseId()); @@ -366,7 +367,7 @@ public class CaseReviewFunctionalCaseService { caseReviewHistory.setCreateUser(UserRoleScope.SYSTEM); caseReviewHistory.setCreateTime(System.currentTimeMillis()); caseReviewHistory.setDeleted(false); - caseReviewHistoryMapper.insertSelective(caseReviewHistory); + historyList.add(caseReviewHistory); } private void updateReviewCaseAndCaseStatus(CaseReviewFunctionalCase item) { @@ -522,7 +523,7 @@ public class CaseReviewFunctionalCaseService { } }); //检查是否全部是通过,全是才是PASS,否则是评审中(如果时自动重新提审,会有个system用户,这里需要排出一下) - if (hasReviewedUserMap.get(UserRoleScope.SYSTEM) !=null) { + if (hasReviewedUserMap.get(UserRoleScope.SYSTEM) != null) { hasReviewedUserMap.remove(UserRoleScope.SYSTEM); } if (unPassCount.get() > 0) { @@ -806,13 +807,24 @@ public class CaseReviewFunctionalCaseService { example.createCriteria().andCaseIdIn(caseIds); List caseReviewFunctionalCases = caseReviewFunctionalCaseMapper.selectByExample(example); Map> reviews = caseReviewFunctionalCases.stream().collect(Collectors.groupingBy(CaseReviewFunctionalCase::getReviewId)); + List historyList = new ArrayList<>(); + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); + CaseReviewFunctionalCaseMapper caseReviewFunctionalCaseMapper = sqlSession.getMapper(CaseReviewFunctionalCaseMapper.class); + FunctionalCaseMapper functionalCaseMapper = sqlSession.getMapper(FunctionalCaseMapper.class); reviews.forEach((k, v) -> { Map countMap = new HashMap<>(); Map statusMap = new HashMap<>(); v.forEach(c -> { - extCaseReviewHistoryMapper.updateAbandoned(c.getCaseId()); - updateReviewCaseAndCaseStatus(c); - insertHistory(c); + c.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.name()); + c.setUpdateTime(System.currentTimeMillis()); + caseReviewFunctionalCaseMapper.updateByPrimaryKeySelective(c); + + FunctionalCase functionalCase = new FunctionalCase(); + functionalCase.setId(c.getCaseId()); + functionalCase.setReviewStatus(FunctionalCaseReviewStatus.RE_REVIEWED.name()); + functionalCaseMapper.updateByPrimaryKeySelective(functionalCase); + + insertHistory(c, historyList); statusMap.put(c.getCaseId(), c.getStatus()); }); //更新用例触发重新提审-需要重新计算评审的整体状态 @@ -826,5 +838,10 @@ public class CaseReviewFunctionalCaseService { param.put(CaseEvent.Param.EVENT_NAME, CaseEvent.Event.REVIEW_FUNCTIONAL_CASE); provider.updateCaseReview(param); }); + + sqlSession.flushStatements(); + SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); + extCaseReviewHistoryMapper.batchUpdateAbandoned(null, caseIds); + caseReviewHistoryMapper.batchInsertSelective(historyList); } } \ No newline at end of file diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java index 9466e7c3aa..9a533a7b90 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalCaseService.java @@ -46,11 +46,7 @@ import io.metersphere.system.log.service.OperationLogService; import io.metersphere.system.mapper.OperationHistoryMapper; import io.metersphere.system.mapper.UserMapper; import io.metersphere.system.notice.constants.NoticeConstants; -import io.metersphere.system.service.CommonNoticeSendService; -import io.metersphere.system.service.BaseCustomFieldOptionService; -import io.metersphere.system.service.BaseCustomFieldService; -import io.metersphere.system.service.OperationHistoryService; -import io.metersphere.system.service.UserLoginService; +import io.metersphere.system.service.*; import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.uid.NumGenerator; import io.metersphere.system.utils.ServiceUtils; @@ -199,8 +195,8 @@ public class FunctionalCaseService { addCaseReviewCase(request.getReviewId(), caseId, userId); //记录日志 - FunctionalCaseHistoryLogDTO historyLogDTO = getImportLogModule(functionalCase); - saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); + FunctionalCaseHistoryLogDTO historyLogDTO = getAddLogModule(functionalCase); + saveAddDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); return functionalCase; } @@ -677,9 +673,9 @@ public class FunctionalCaseService { return handleCustomFields(functionalCaseLists, request.getProjectId()); } - private List handleCustomFields(List functionalCaseLists,String projectId) { + private List handleCustomFields(List functionalCaseLists, String projectId) { List ids = functionalCaseLists.stream().map(FunctionalCasePageDTO::getId).collect(Collectors.toList()); - Map> collect = getCaseCustomFiledMap(ids,projectId); + Map> collect = getCaseCustomFiledMap(ids, projectId); Set userIds = extractUserIds(functionalCaseLists); Map userMap = userLoginService.getUserNameMap(new ArrayList<>(userIds)); functionalCaseLists.forEach(functionalCasePageDTO -> { @@ -698,7 +694,7 @@ public class FunctionalCaseService { .collect(Collectors.toSet()); } - public Map> getCaseCustomFiledMap(List ids,String projectId) { + public Map> getCaseCustomFiledMap(List ids, String projectId) { List memberCustomOption = getMemberOptions(projectId); List customFields = functionalCaseCustomFieldService.getCustomFieldsByCaseIds(ids); customFields.forEach(customField -> { @@ -834,7 +830,7 @@ public class FunctionalCaseService { historyLogDTO.setCustomFields(customFields); historyLogDTO.setCaseAttachments(caseAttachments); historyLogDTO.setFileAssociationList(fileAssociationList); - saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); + saveAddDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.ADD.name(), OperationLogModule.FUNCTIONAL_CASE); } } } @@ -1006,20 +1002,57 @@ public class FunctionalCaseService { FunctionalCaseCustomFieldMapper customFieldMapper = sqlSession.getMapper(FunctionalCaseCustomFieldMapper.class); Long nextOrder = getNextOrder(request.getProjectId()); List noticeList = new ArrayList<>(); + List historyLogDTOS = new ArrayList<>(); + List logDTOS = new ArrayList<>(); + List caseIds = new ArrayList<>(); for (int i = list.size() - 1; i > -1; i--) { - parseInsertDataToModule(list.get(i), request, user.getId(), caseModulePathMap, defaultTemplateDTO, nextOrder, caseMapper, caseBlobMapper, customFieldMapper, customFieldsMap, user.getLastOrganizationId()); + parseInsertDataToModule(list.get(i), request, user.getId(), caseModulePathMap, defaultTemplateDTO, nextOrder, caseMapper, caseBlobMapper, customFieldMapper, customFieldsMap, caseIds, historyLogDTOS); nextOrder += ServiceUtils.POS_STEP; //通知 noticeModule(noticeList, list.get(i), request, user.getId(), customFieldsMap); } + sqlSession.flushStatements(); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); + //新增用例记录日志 + historyLogDTOS.forEach(historyLogDTO -> { + batchSaveImportData(historyLogDTO, new FunctionalCaseHistoryLogDTO(), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS); + }); + operationLogService.batchAdd(logDTOS); + List resources = new ArrayList<>(); resources.addAll(JSON.parseArray(JSON.toJSONString(noticeList), Map.class)); commonNoticeSendService.sendNotice(NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, NoticeConstants.Event.CREATE, resources, user, request.getProjectId()); } + /** + * 导入数据日志 批量 + * + * @param historyLogDTO + * @param functionalCaseHistoryLogDTO + * @param user + * @param type + * @param module + * @param logDTOS + */ + private void batchSaveImportData(FunctionalCaseHistoryLogDTO historyLogDTO, FunctionalCaseHistoryLogDTO functionalCaseHistoryLogDTO, SessionUser user, String type, String module, List logDTOS) { + LogDTO dto = new LogDTO( + historyLogDTO.getFunctionalCase().getProjectId(), + user.getLastOrganizationId(), + historyLogDTO.getFunctionalCase().getId(), + user.getId(), + type, + module, + historyLogDTO.getFunctionalCase().getName()); + dto.setHistory(true); + dto.setPath("/functional/case/import/excel"); + dto.setMethod(HttpMethodConstants.POST.name()); + dto.setModifiedValue(JSON.toJSONBytes(historyLogDTO)); + dto.setOriginalValue(JSON.toJSONBytes(functionalCaseHistoryLogDTO)); + logDTOS.add(dto); + } + /** * 组装通知数据 * @@ -1050,7 +1083,7 @@ public class FunctionalCaseService { } private void parseInsertDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map caseModulePathMap, TemplateDTO defaultTemplateDTO, Long nextOrder, - FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap, String organizationId) { + FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap, List caseIds, List historyLogDTOS) { //构建用例 FunctionalCase functionalCase = new FunctionalCase(); String caseId = IDGenerator.nextStr(); @@ -1084,15 +1117,11 @@ public class FunctionalCaseService { caseBlobMapper.insertSelective(caseBlob); //自定义字段 - handleImportCustomField(functionalCaseExcelData, caseId, customFieldMapper, customFieldsMap); + List customFields = handleImportCustomField(functionalCaseExcelData, caseId, customFieldMapper, customFieldsMap); - //新增用例记录日志 - FunctionalCaseCustomFieldExample fieldExample = new FunctionalCaseCustomFieldExample(); - fieldExample.createCriteria().andCaseIdEqualTo(functionalCase.getId()); - List customFields = functionalCaseCustomFieldMapper.selectByExample(fieldExample); - FunctionalCaseHistoryLogDTO historyLogDTO = new FunctionalCaseHistoryLogDTO(functionalCase, caseBlob, customFields, new ArrayList<>(), new ArrayList<>()); + caseIds.add(functionalCase.getId()); + historyLogDTOS.add(new FunctionalCaseHistoryLogDTO(functionalCase, caseBlob, customFields, new ArrayList<>(), new ArrayList<>())); - saveImportDataLog(functionalCase, new FunctionalCaseHistoryLogDTO(), historyLogDTO, userId, organizationId, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE); } @@ -1116,7 +1145,8 @@ public class FunctionalCaseService { * @param customFieldMapper 自定义字段mapper * @param customFieldsMap 当前默认模板的自定义字段 */ - private void handleImportCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap) { + private List handleImportCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap) { + List customFields = new ArrayList<>(); //需要保存的自定义字段 Map customData = functionalCaseExcelData.getCustomData(); customFieldsMap.forEach((k, v) -> { @@ -1129,8 +1159,10 @@ public class FunctionalCaseService { }, () -> { setCustomFieldValue(v.getDefaultValue(), caseCustomField); }); + customFields.add(caseCustomField); customFieldMapper.insertSelective(caseCustomField); }); + return customFields; } private void setCustomFieldValue(Object value, FunctionalCaseCustomField caseCustomField) { @@ -1160,18 +1192,35 @@ public class FunctionalCaseService { List modulePath = updateList.stream().map(FunctionalCaseExcelData::getModule).toList(); //构建模块树 Map caseModulePathMap = functionalCaseModuleService.createCaseModule(modulePath, request.getProjectId(), moduleTree, user.getId(), pathMap); + + //获取重新提审标识 + ProjectApplicationExample example = new ProjectApplicationExample(); + example.createCriteria().andProjectIdEqualTo(request.getProjectId()).andTypeEqualTo(ProjectApplicationType.CASE.CASE_RE_REVIEW.name()); + List projectApplications = projectApplicationMapper.selectByExample(example); + + List ids = updateList.stream().map(FunctionalCaseExcelData::getNum).toList(); + List caseList = getCaseDataByIds(ids); + Map> collect = caseList.stream().collect(Collectors.groupingBy(FunctionalCase::getId)); + List blobs = getBlobDataByIds(ids); + Map> blobsCollect = blobs.stream().collect(Collectors.groupingBy(FunctionalCaseBlob::getId)); + Map> customFieldMap = functionalCaseCustomFieldService.getCustomFieldMapByCaseIds(ids); + SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); FunctionalCaseMapper caseMapper = sqlSession.getMapper(FunctionalCaseMapper.class); FunctionalCaseBlobMapper caseBlobMapper = sqlSession.getMapper(FunctionalCaseBlobMapper.class); FunctionalCaseCustomFieldMapper customFieldMapper = sqlSession.getMapper(FunctionalCaseCustomFieldMapper.class); List noticeList = new ArrayList<>(); List caseIds = new ArrayList<>(); + List historyLogDTOS = new ArrayList<>(); + List logDTOS = new ArrayList<>(); + for (int i = 0; i < updateList.size(); i++) { - parseUpdateDataToModule(updateList.get(i), request, user.getId(), caseModulePathMap, defaultTemplateDTO, caseMapper, caseBlobMapper, customFieldMapper, customFieldsMap, user.getLastOrganizationId(), caseIds); + parseUpdateDataToModule(updateList.get(i), request, user.getId(), caseModulePathMap, defaultTemplateDTO, caseMapper, caseBlobMapper, customFieldMapper, customFieldsMap, collect, historyLogDTOS); + // 重新提审的数据 + addStatusIds(projectApplications, caseIds, collect, blobsCollect, updateList.get(i)); //通知 noticeModule(noticeList, updateList.get(i), request, user.getId(), customFieldsMap); } - sqlSession.flushStatements(); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); @@ -1180,21 +1229,53 @@ public class FunctionalCaseService { caseReviewFunctionalCaseService.batchHandleStatusAndHistory(caseIds, user.getId()); } + // 日志 + historyLogDTOS.forEach(historyLogDTO -> { + batchHandImportUpdateLog(historyLogDTO, collect, blobsCollect, customFieldMap, logDTOS, user); + }); + operationLogService.batchAdd(logDTOS); + List resources = new ArrayList<>(); resources.addAll(JSON.parseArray(JSON.toJSONString(noticeList), Map.class)); commonNoticeSendService.sendNotice(NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, NoticeConstants.Event.UPDATE, resources, user, request.getProjectId()); } + private void batchHandImportUpdateLog(FunctionalCaseHistoryLogDTO newData, Map> collect, Map> blobsCollect, Map> customFieldMap, List logDTOS, SessionUser user) { + FunctionalCase oldCase = collect.get(newData.getFunctionalCase().getId()).get(0); + FunctionalCaseBlob oldBlod = blobsCollect.get(newData.getFunctionalCase().getId()).get(0); + List oldCustomFields = customFieldMap.get(newData.getFunctionalCase().getId()); + batchSaveImportData(newData, new FunctionalCaseHistoryLogDTO(oldCase, oldBlod, oldCustomFields, new ArrayList<>(), new ArrayList<>()), user, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE, logDTOS); + } - private void parseUpdateDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map caseModulePathMap, TemplateDTO defaultTemplateDTO, FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap, String organizationId, List caseIds) { + /** + * 获取更新的用例大字段数据 + * + * @param ids + * @return + */ + private List getBlobDataByIds(List ids) { + FunctionalCaseBlobExample blobExample = new FunctionalCaseBlobExample(); + blobExample.createCriteria().andIdIn(ids); + return functionalCaseBlobMapper.selectByExampleWithBLOBs(blobExample); + } + + /** + * 获取更新的用例数据 + * + * @param ids + * @return + */ + private List getCaseDataByIds(List ids) { + FunctionalCaseExample example = new FunctionalCaseExample(); + example.createCriteria().andIdIn(ids); + return functionalCaseMapper.selectByExample(example); + } + + + private void parseUpdateDataToModule(FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map caseModulePathMap, TemplateDTO defaultTemplateDTO, FunctionalCaseMapper caseMapper, FunctionalCaseBlobMapper caseBlobMapper, + FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap, Map> collect, List historyLogDTOS) { //用例表 - FunctionalCase functionalCase = caseMapper.selectByPrimaryKey(functionalCaseExcelData.getNum()); - - //触发重新提审id - addStatusIds(caseIds, functionalCase, functionalCaseExcelData); - - //记录原值 - FunctionalCaseHistoryLogDTO originalValue = getImportLogModule(functionalCase); + FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0); functionalCase.setName(functionalCaseExcelData.getName()); functionalCase.setModuleId(caseModulePathMap.get(functionalCaseExcelData.getModule())); @@ -1218,20 +1299,17 @@ public class FunctionalCaseService { caseBlobMapper.updateByPrimaryKeyWithBLOBs(caseBlob); //自定义字段 - handleUpdateCustomField(functionalCaseExcelData, functionalCase.getId(), customFieldMapper, customFieldsMap); + List customFields = handleUpdateCustomField(functionalCaseExcelData, functionalCase.getId(), customFieldMapper, customFieldsMap); + + // 记录新值 + historyLogDTOS.add(new FunctionalCaseHistoryLogDTO(functionalCase, caseBlob, customFields, new ArrayList<>(), new ArrayList<>())); - //记录新值 - FunctionalCaseHistoryLogDTO modifiedLogDTO = getImportLogModule(functionalCase); - //记录日志 - saveImportDataLog(functionalCase, originalValue, modifiedLogDTO, userId, organizationId, OperationLogType.IMPORT.name(), OperationLogModule.FUNCTIONAL_CASE); } - private void addStatusIds(List caseIds, FunctionalCase functionalCase, FunctionalCaseExcelData functionalCaseExcelData) { - ProjectApplicationExample example = new ProjectApplicationExample(); - example.createCriteria().andProjectIdEqualTo(functionalCase.getProjectId()).andTypeEqualTo(ProjectApplicationType.CASE.CASE_RE_REVIEW.name()); - List projectApplications = projectApplicationMapper.selectByExample(example); + private void addStatusIds(List projectApplications, List caseIds, Map> collect, Map> blobsCollect, FunctionalCaseExcelData functionalCaseExcelData) { + FunctionalCase functionalCase = collect.get(functionalCaseExcelData.getNum()).get(0); if (CollectionUtils.isNotEmpty(projectApplications) && Boolean.valueOf(projectApplications.get(0).getTypeValue())) { - FunctionalCaseBlob blob = functionalCaseBlobMapper.selectByPrimaryKey(functionalCase.getId()); + FunctionalCaseBlob blob = blobsCollect.get(functionalCaseExcelData.getNum()).get(0); if (!StringUtils.equals(functionalCase.getName(), functionalCaseExcelData.getName()) || !StringUtils.equals(new String(blob.getSteps(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getSteps(), StringUtils.EMPTY)) || !StringUtils.equals(new String(blob.getTextDescription(), StandardCharsets.UTF_8), StringUtils.defaultIfBlank(functionalCaseExcelData.getTextDescription(), StringUtils.EMPTY)) @@ -1241,11 +1319,12 @@ public class FunctionalCaseService { } } - private void handleUpdateCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap) { + private List handleUpdateCustomField(FunctionalCaseExcelData functionalCaseExcelData, String caseId, FunctionalCaseCustomFieldMapper customFieldMapper, Map customFieldsMap) { FunctionalCaseCustomFieldExample fieldExample = new FunctionalCaseCustomFieldExample(); fieldExample.createCriteria().andCaseIdEqualTo(caseId); customFieldMapper.deleteByExample(fieldExample); - handleImportCustomField(functionalCaseExcelData, caseId, customFieldMapper, customFieldsMap); + List customFields = handleImportCustomField(functionalCaseExcelData, caseId, customFieldMapper, customFieldsMap); + return customFields; } @@ -1256,7 +1335,7 @@ public class FunctionalCaseService { * @param originalValue 原值 * @param modifiedLogDTO 新值 */ - private void saveImportDataLog(FunctionalCase functionalCase, FunctionalCaseHistoryLogDTO originalValue, FunctionalCaseHistoryLogDTO modifiedLogDTO, String userId, String organizationId, String type, String module) { + private void saveAddDataLog(FunctionalCase functionalCase, FunctionalCaseHistoryLogDTO originalValue, FunctionalCaseHistoryLogDTO modifiedLogDTO, String userId, String organizationId, String type, String module) { LogDTO dto = new LogDTO( functionalCase.getProjectId(), organizationId, @@ -1266,7 +1345,7 @@ public class FunctionalCaseService { module, functionalCase.getName()); dto.setHistory(true); - dto.setPath("/functional/case/import/excel"); + dto.setPath("/functional/case/add"); dto.setMethod(HttpMethodConstants.POST.name()); dto.setModifiedValue(JSON.toJSONBytes(modifiedLogDTO)); dto.setOriginalValue(JSON.toJSONBytes(originalValue)); @@ -1279,7 +1358,7 @@ public class FunctionalCaseService { * @param functionalCase * @return */ - private FunctionalCaseHistoryLogDTO getImportLogModule(FunctionalCase functionalCase) { + private FunctionalCaseHistoryLogDTO getAddLogModule(FunctionalCase functionalCase) { FunctionalCaseBlob functionalCaseBlob = functionalCaseBlobMapper.selectByPrimaryKey(functionalCase.getId()); //自定义字段 FunctionalCaseCustomFieldExample fieldExample = new FunctionalCaseCustomFieldExample();