fix(测试计划): 修复用例&评审&计划富文本图片问题
This commit is contained in:
parent
4dbe854cf9
commit
013733e7f2
|
@ -104,4 +104,6 @@ public interface ExtFunctionalCaseMapper {
|
||||||
List<FunctionalCase> getListBySelectModules(@Param("isRepeat") boolean isRepeat, @Param("projectId") String projectId, @Param("moduleIds") List<String> moduleIds, @Param("testPlanId") String testPlanId);
|
List<FunctionalCase> getListBySelectModules(@Param("isRepeat") boolean isRepeat, @Param("projectId") String projectId, @Param("moduleIds") List<String> moduleIds, @Param("testPlanId") String testPlanId);
|
||||||
|
|
||||||
List<FunctionalCase> getListBySelectIds(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId);
|
List<FunctionalCase> getListBySelectIds(@Param("projectId") String projectId, @Param("ids") List<String> ids, @Param("testPlanId") String testPlanId);
|
||||||
|
|
||||||
|
List<FunctionalCase> getProjectIdByIds(@Param("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|
|
@ -951,4 +951,11 @@
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getProjectIdByIds" resultType="io.metersphere.functional.domain.FunctionalCase">
|
||||||
|
select id, project_id from functional_case where id in
|
||||||
|
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -505,10 +505,6 @@ public class FunctionalCaseAttachmentService {
|
||||||
fileCopyRequest.setStorage(StorageType.MINIO.toString());
|
fileCopyRequest.setStorage(StorageType.MINIO.toString());
|
||||||
fileService.upload(previewImg, fileCopyRequest);
|
fileService.upload(previewImg, fileCopyRequest);
|
||||||
}
|
}
|
||||||
// 删除临时文件
|
|
||||||
fileCopyRequest.setFolder(systemTempDir + "/" + fileId);
|
|
||||||
fileCopyRequest.setFileName(fileName);
|
|
||||||
defaultRepository.delete(fileCopyRequest);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtils.error("上传副文本文件失败:{}",e);
|
LogUtils.error("上传副文本文件失败:{}",e);
|
||||||
throw new MSException(Translator.get("file_upload_fail"));
|
throw new MSException(Translator.get("file_upload_fail"));
|
||||||
|
|
|
@ -71,8 +71,9 @@ public class FunctionalCaseCommentService {
|
||||||
* @return FunctionalCaseComment
|
* @return FunctionalCaseComment
|
||||||
*/
|
*/
|
||||||
public FunctionalCaseComment saveComment(FunctionalCaseCommentRequest functionalCaseCommentRequest, String userId) {
|
public FunctionalCaseComment saveComment(FunctionalCaseCommentRequest functionalCaseCommentRequest, String userId) {
|
||||||
checkCase(functionalCaseCommentRequest.getCaseId());
|
FunctionalCase functionalCase = checkCase(functionalCaseCommentRequest.getCaseId());
|
||||||
FunctionalCaseComment functionalCaseComment = getFunctionalCaseComment(functionalCaseCommentRequest, userId);
|
FunctionalCaseComment functionalCaseComment = getFunctionalCaseComment(functionalCaseCommentRequest, userId);
|
||||||
|
functionalCaseCommentRequest.setProjectId(functionalCase.getProjectId());
|
||||||
if (StringUtils.equals(functionalCaseCommentRequest.getEvent(), NoticeConstants.Event.REPLY)) {
|
if (StringUtils.equals(functionalCaseCommentRequest.getEvent(), NoticeConstants.Event.REPLY)) {
|
||||||
return saveCommentWidthReply(functionalCaseCommentRequest, functionalCaseComment, userId);
|
return saveCommentWidthReply(functionalCaseCommentRequest, functionalCaseComment, userId);
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,11 +101,12 @@ public class FunctionalCaseCommentService {
|
||||||
return functionalCaseComment;
|
return functionalCaseComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCase(String caseId) {
|
private FunctionalCase checkCase(String caseId) {
|
||||||
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId);
|
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(caseId);
|
||||||
if (functionalCase == null) {
|
if (functionalCase == null) {
|
||||||
throw new MSException(Translator.get("case_comment.case_is_null"));
|
throw new MSException(Translator.get("case_comment.case_is_null"));
|
||||||
}
|
}
|
||||||
|
return functionalCase;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -626,14 +626,16 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
List<TestPlanFunctionalCase> functionalCases = testPlanFunctionalCaseMapper.selectByExample(example);
|
List<TestPlanFunctionalCase> functionalCases = testPlanFunctionalCaseMapper.selectByExample(example);
|
||||||
List<String> caseIds = functionalCases.stream().map(TestPlanFunctionalCase::getFunctionalCaseId).collect(Collectors.toList());
|
List<String> caseIds = functionalCases.stream().map(TestPlanFunctionalCase::getFunctionalCaseId).collect(Collectors.toList());
|
||||||
Map<String, String> idsMap = functionalCases.stream().collect(Collectors.toMap(TestPlanFunctionalCase::getId, TestPlanFunctionalCase::getFunctionalCaseId));
|
Map<String, String> idsMap = functionalCases.stream().collect(Collectors.toMap(TestPlanFunctionalCase::getId, TestPlanFunctionalCase::getFunctionalCaseId));
|
||||||
List<TestPlanCaseExecuteHistory> historyList = getExecHistory(ids, request, logInsertModule, idsMap);
|
List<FunctionalCase> list = extFunctionalCaseMapper.getProjectIdByIds(caseIds);
|
||||||
|
Map<String, String> projectMap = list.stream().collect(Collectors.toMap(FunctionalCase::getId, FunctionalCase::getProjectId));
|
||||||
|
List<TestPlanCaseExecuteHistory> historyList = getExecHistory(ids, request, logInsertModule, idsMap, projectMap);
|
||||||
testPlanCaseExecuteHistoryMapper.batchInsert(historyList);
|
testPlanCaseExecuteHistoryMapper.batchInsert(historyList);
|
||||||
|
|
||||||
updateFunctionalCaseStatus(caseIds, request.getLastExecResult());
|
updateFunctionalCaseStatus(caseIds, request.getLastExecResult());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TestPlanCaseExecuteHistory> getExecHistory(List<String> ids, TestPlanCaseBatchRunRequest request, LogInsertModule logInsertModule, Map<String, String> idsMap) {
|
private List<TestPlanCaseExecuteHistory> getExecHistory(List<String> ids, TestPlanCaseBatchRunRequest request, LogInsertModule logInsertModule, Map<String, String> idsMap, Map<String, String> projectMap) {
|
||||||
|
|
||||||
List<TestPlanCaseExecuteHistory> historyList = new ArrayList<>();
|
List<TestPlanCaseExecuteHistory> historyList = new ArrayList<>();
|
||||||
ids.forEach(id -> {
|
ids.forEach(id -> {
|
||||||
|
@ -649,8 +651,8 @@ public class TestPlanFunctionalCaseService extends TestPlanResourceService {
|
||||||
executeHistory.setCreateUser(logInsertModule.getOperator());
|
executeHistory.setCreateUser(logInsertModule.getOperator());
|
||||||
executeHistory.setCreateTime(System.currentTimeMillis());
|
executeHistory.setCreateTime(System.currentTimeMillis());
|
||||||
historyList.add(executeHistory);
|
historyList.add(executeHistory);
|
||||||
|
String caseId = idsMap.get(id);
|
||||||
handleFileAndNotice(idsMap.get(id), request.getProjectId(), request.getPlanCommentFileIds(), logInsertModule.getOperator(), CaseFileSourceType.PLAN_COMMENT.toString(), request.getNotifier(), request.getTestPlanId(), request.getLastExecResult());
|
handleFileAndNotice(caseId, projectMap.get(caseId), request.getPlanCommentFileIds(), logInsertModule.getOperator(), CaseFileSourceType.PLAN_COMMENT.toString(), request.getNotifier(), request.getTestPlanId(), request.getLastExecResult());
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue