refactor(消息通知): 补充消息通知数据

This commit is contained in:
guoyuqi 2023-11-03 18:41:02 +08:00 committed by 刘瑞斌
parent f34c916760
commit 6d87d98e01
14 changed files with 58 additions and 36 deletions

View File

@ -374,6 +374,7 @@ message.domain.bug_createTime=创建时间
message.domain.bug_updateTime=更新时间
message.domain.bug_deleteUser=删除人
message.domain.bug_deleteTime=删除时间
message.domain.bug_handleUser=处理人
#UI
message.domain.ui_name=场景名称
message.domain.ui_level=用例等级
@ -389,6 +390,7 @@ message.domain.ui_createTime=创建时间
message.domain.ui_updateTime=更新时间
message.domain.ui_deleteUser=删除人
message.domain.ui_deleteTime=删除时间
message.domain.ui_description=描述
#性能
message.domain.load_name=测试名称
message.domain.load_status=状态
@ -397,6 +399,7 @@ message.domain.load_createUser=创建人
message.domain.load_updateUser=更新人
message.domain.load_createTime=创建时间
message.domain.load_updateTime=更新时间
message.domain.load_description=描述
#定时任务
message.domain.schedule_key=qrtz UUID
message.domain.schedule_type=资源类型

View File

@ -410,6 +410,7 @@ message.domain.bug_createTime=Create time
message.domain.bug_updateTime=Update time
message.domain.bug_deleteUser=Delete user
message.domain.bug_deleteTime=Delete time
message.domain.bug_handleUser=Processor
#UI
message.domain.ui_name=Scenario name
message.domain.ui_level=Case level
@ -425,6 +426,7 @@ message.domain.ui_createTime=Create time
message.domain.ui_updateTime=Update time
message.domain.ui_deleteUser=Delete user
message.domain.ui_deleteTime=Delete time
message.domain.ui_description=Description
#性能
message.domain.load_name=Test name
message.domain.load_status=Status
@ -433,6 +435,7 @@ message.domain.load_createUser=Create user
message.domain.load_updateUser=Update user
message.domain.load_createTime=Create time
message.domain.load_updateTime=Update time
message.domain.load_description=Description
#定时任务
message.domain.schedule_key=qrtz UUID
message.domain.schedule_type=Resource Type

View File

@ -409,6 +409,7 @@ message.domain.bug_createTime=创建时间
message.domain.bug_updateTime=更新时间
message.domain.bug_deleteUser=删除人
message.domain.bug_deleteTime=删除时间
message.domain.bug_handleUser=处理人
#UI
message.domain.ui_name=场景名称
message.domain.ui_level=用例等级
@ -424,6 +425,7 @@ message.domain.ui_createTime=创建时间
message.domain.ui_updateTime=更新时间
message.domain.ui_deleteUser=删除人
message.domain.ui_deleteTime=删除时间
message.domain.ui_description=描述
#性能
message.domain.load_name=测试名称
message.domain.load_status=状态
@ -432,6 +434,7 @@ message.domain.load_createUser=创建人
message.domain.load_updateUser=更新人
message.domain.load_createTime=创建时间
message.domain.load_updateTime=更新时间
message.domain.load_description=描述
#定时任务
message.domain.schedule_key=qrtz UUID
message.domain.schedule_type=资源类型

View File

@ -410,6 +410,7 @@ message.domain.bug_createTime=創建時間
message.domain.bug_updateTime=更新時間
message.domain.bug_deleteUser=删除人
message.domain.bug_deleteTime=刪除時間
message.domain.bug_handleUser=處理人
#UI
message.domain.ui_name=場景名稱
message.domain.ui_level=用例等級
@ -425,6 +426,7 @@ message.domain.ui_createTime=創建時間
message.domain.ui_updateTime=更新時間
message.domain.ui_deleteUser=删除人
message.domain.ui_deleteTime=刪除時間
message.domain.ui_description=描述
#性能
message.domain.load_name=測試名稱
message.domain.load_status=狀態
@ -433,6 +435,7 @@ message.domain.load_createUser=創建人
message.domain.load_updateUser=更新人
message.domain.load_createTime=創建時間
message.domain.load_updateTime=更新時間
message.domain.load_description=描述
#定时任务
message.domain.schedule_key=qrtz UUID
message.domain.schedule_type=資源類型

View File

@ -61,7 +61,7 @@ public class FunctionalCaseController {
@Operation(summary = "功能用例-新增用例")
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_ADD)
@Log(type = OperationLogType.ADD, expression = "#msClass.addFunctionalCaseLog(#request, #files)", msClass = FunctionalCaseLogService.class)
@SendNotice(taskType = NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, event = NoticeConstants.Event.CREATE, target = "#targetClass.getMainFunctionalCaseDTO(#request.name, #request.caseEditType, #request.customsFields)", targetClass = FunctionalCaseNoticeService.class)
@SendNotice(taskType = NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, event = NoticeConstants.Event.CREATE, target = "#targetClass.getMainFunctionalCaseDTO(#request.name, #request.caseEditType, #request.projectId, #request.customsFields)", targetClass = FunctionalCaseNoticeService.class)
public FunctionalCase addFunctionalCase(@Validated @RequestPart("request") FunctionalCaseAddRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> files) {
String userId = SessionUtils.getUserId();
return functionalCaseService.addFunctionalCase(request, files, userId);
@ -80,7 +80,7 @@ public class FunctionalCaseController {
@Operation(summary = "功能用例-更新用例")
@RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ_UPDATE)
@Log(type = OperationLogType.UPDATE, expression = "#msClass.updateFunctionalCaseLog(#request, #files)", msClass = FunctionalCaseLogService.class)
@SendNotice(taskType = NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, event = NoticeConstants.Event.UPDATE, target = "#targetClass.getMainFunctionalCaseDTO(#request.name, #request.caseEditType, #request.customsFields)", targetClass = FunctionalCaseNoticeService.class)
@SendNotice(taskType = NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, event = NoticeConstants.Event.UPDATE, target = "#targetClass.getMainFunctionalCaseDTO(#request.name, #request.caseEditType, #request.projectId, #request.customsFields)", targetClass = FunctionalCaseNoticeService.class)
public FunctionalCase updateFunctionalCase(@Validated @RequestPart("request") FunctionalCaseEditRequest request, @RequestPart(value = "files", required = false) List<MultipartFile> files) {
String userId = SessionUtils.getUserId();
return functionalCaseService.updateFunctionalCase(request, files, userId);

View File

@ -1,6 +1,6 @@
package io.metersphere.functional.dto;
import io.metersphere.functional.domain.FunctionalCase;
import io.metersphere.system.dto.sdk.FunctionalCaseMessageDTO;
import io.metersphere.system.dto.sdk.OptionDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@ -8,7 +8,13 @@ import lombok.Data;
import java.util.List;
@Data
public class FunctionalCaseDTO extends FunctionalCase {
public class FunctionalCaseDTO extends FunctionalCaseMessageDTO {
@Schema(description = "id")
private String id;
@Schema(description = "项目ID")
private String projectId;
@Schema(description = "评论@的人, 多个以';'隔开")
private String relatedUsers;
@ -16,4 +22,7 @@ public class FunctionalCaseDTO extends FunctionalCase {
@Schema(description = "自定义字段的值")
private List<OptionDTO> fields;
@Schema(description = "触发方式:功能用例执行相关(测试计划/定时任务/用例评审)")
private String triggerMode;
}

View File

@ -1,6 +1,8 @@
package io.metersphere.functional.service;
import io.metersphere.functional.domain.FunctionalCaseModuleExample;
import io.metersphere.functional.mapper.ExtFunctionalCaseMapper;
import io.metersphere.functional.mapper.FunctionalCaseModuleMapper;
import io.metersphere.sdk.util.LogUtils;
import io.metersphere.system.service.CleanupProjectResourceService;
import jakarta.annotation.Resource;
@ -22,6 +24,9 @@ public class CleanupFunctionalCaseResourceService implements CleanupProjectResou
@Resource
private DeleteFunctionalCaseService deleteFunctionalCaseService;
@Resource
private FunctionalCaseModuleMapper functionalCaseModuleMapper;
@Override
public void deleteResources(String projectId) {
@ -29,6 +34,10 @@ public class CleanupFunctionalCaseResourceService implements CleanupProjectResou
if (CollectionUtils.isNotEmpty(ids)) {
deleteFunctionalCaseService.deleteFunctionalCaseResource(ids, projectId);
}
//删除模块
FunctionalCaseModuleExample functionalCaseModuleExample = new FunctionalCaseModuleExample();
functionalCaseModuleExample.createCriteria().andProjectIdEqualTo(projectId);
functionalCaseModuleMapper.deleteByExample(functionalCaseModuleExample);
}
@Override

View File

@ -1,10 +1,7 @@
package io.metersphere.functional.service;
import io.metersphere.functional.domain.*;
import io.metersphere.functional.mapper.FunctionalCaseBlobMapper;
import io.metersphere.functional.mapper.FunctionalCaseCustomFieldMapper;
import io.metersphere.functional.mapper.FunctionalCaseMapper;
import io.metersphere.functional.mapper.FunctionalCaseTestMapper;
import io.metersphere.functional.mapper.*;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -28,14 +25,20 @@ public class DeleteFunctionalCaseService {
private FunctionalCaseBlobMapper functionalCaseBlobMapper;
@Resource
private FunctionalCaseMapper functionalCaseMapper;
@Resource
private FunctionalCaseCommentMapper functionalCaseCommentMapper;
public void deleteFunctionalCaseResource(List<String> ids, String projectId) {
//TODO 删除各种关联关系 1.测试用例(接口/场景/ui/性能) 2.关联缺陷(是否需要同步) 3.关联需求(是否需要同步) 4.依赖关系 5.关联评审 6.操作记录 7.关联测试计划 8.评论 9.附件 10.自定义字段 11.用例基本信息(主表附属表)12.模块? 13...?
//TODO 删除各种关联关系 1.测试用例(接口/场景/ui/性能) 2.关联缺陷(是否需要同步) 3.关联需求(是否需要同步) 4.依赖关系 5.关联评审 6.操作记录 7.关联测试计划 8.评论 9.附件 10.自定义字段 11.用例基本信息(主表附属表) 12...?
//1.刪除用例与其他用例关联关系
FunctionalCaseTestExample caseTestExample = new FunctionalCaseTestExample();
caseTestExample.createCriteria().andCaseIdIn(ids);
functionalCaseTestMapper.deleteByExample(caseTestExample);
//8.评论
FunctionalCaseCommentExample functionalCaseCommentExample = new FunctionalCaseCommentExample();
functionalCaseCommentExample.createCriteria().andCaseIdIn(ids);
functionalCaseCommentMapper.deleteByExample(functionalCaseCommentExample);
//9.附件
functionalCaseAttachmentService.deleteAttachmentResource(ids, projectId);
//10.自定义字段

View File

@ -67,9 +67,9 @@ public class FunctionalCaseCommentService {
checkCase(functionalCaseCommentRequest.getCaseId());
FunctionalCaseComment functionalCaseComment = getFunctionalCaseComment(functionalCaseCommentRequest, userId);
if (StringUtils.equals(functionalCaseCommentRequest.getEvent(), NoticeConstants.Event.REPLY)) {
return saveCommentWidthNotice(functionalCaseCommentRequest, functionalCaseComment, userId);
return saveCommentWidthReply(functionalCaseCommentRequest, functionalCaseComment, userId);
} else {
return saveCommentWidthOutNotice(functionalCaseCommentRequest, functionalCaseComment, userId);
return saveCommentWidthOther(functionalCaseCommentRequest, functionalCaseComment, userId);
}
}
@ -107,7 +107,7 @@ public class FunctionalCaseCommentService {
* @param functionalCaseComment 被组装的半份数据
* @return FunctionalCaseComment
*/
public FunctionalCaseComment saveCommentWidthOutNotice(FunctionalCaseCommentRequest functionalCaseCommentRequest, FunctionalCaseComment functionalCaseComment, String userId) {
public FunctionalCaseComment saveCommentWidthOther(FunctionalCaseCommentRequest functionalCaseCommentRequest, FunctionalCaseComment functionalCaseComment, String userId) {
if (StringUtils.isNotBlank(functionalCaseCommentRequest.getNotifier())) {
functionalCaseComment.setNotifier(functionalCaseCommentRequest.getNotifier());
}
@ -127,7 +127,7 @@ public class FunctionalCaseCommentService {
* @param functionalCaseComment 被组装的半份数据
* @return FunctionalCaseComment
*/
public FunctionalCaseComment saveCommentWidthNotice(FunctionalCaseCommentRequest functionalCaseCommentRequest, FunctionalCaseComment functionalCaseComment, String userId) {
public FunctionalCaseComment saveCommentWidthReply(FunctionalCaseCommentRequest functionalCaseCommentRequest, FunctionalCaseComment functionalCaseComment, String userId) {
setOther(functionalCaseCommentRequest, functionalCaseComment);
functionalCaseCommentMapper.insert(functionalCaseComment);
FunctionalCaseDTO functionalCaseDTOReply = functionalCaseNoticeService.getFunctionalCaseDTO(functionalCaseCommentRequest);

View File

@ -1,16 +0,0 @@
/**
* @filename:FunctionalCaseFollowServiceImpl 2023年5月17日
* @project ms V3.x
* Copyright(c) 2018 wx Co. Ltd.
* All right reserved.
*/
package io.metersphere.functional.service;
import org.springframework.stereotype.Service;
@Service
public class FunctionalCaseFollowService {
}

View File

@ -42,6 +42,8 @@ public class FunctionalCaseNoticeService {
setNotifier(functionalCaseCommentRequest, functionalCaseDTO);
List<OptionDTO> customFields = getCustomFields(functionalCaseCommentRequest.getCaseId());
functionalCaseDTO.setFields(customFields);
//TODO:设置测试计划名称
//TODO设置用例评审名称
return functionalCaseDTO;
}
@ -113,10 +115,11 @@ public class FunctionalCaseNoticeService {
return optionDTOList;
}
public FunctionalCaseDTO getMainFunctionalCaseDTO(String name, String caseEditType, List<CaseCustomsFieldDTO> customsFields) {
public FunctionalCaseDTO getMainFunctionalCaseDTO(String name, String caseEditType,String projectId, List<CaseCustomsFieldDTO> customsFields) {
String userId = SessionUtils.getUserId();
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
functionalCaseDTO.setName(name);
functionalCaseDTO.setProjectId(projectId);
functionalCaseDTO.setCaseEditType(caseEditType);
functionalCaseDTO.setCreateUser(userId);
List<OptionDTO> fields = new ArrayList<>();
@ -133,22 +136,23 @@ public class FunctionalCaseNoticeService {
}
}
functionalCaseDTO.setFields(fields);
//TODO:设置测试计划名称
//TODO设置用例评审名称
return functionalCaseDTO;
}
public FunctionalCaseDTO getDeleteFunctionalCaseDTO(String id){
String userId = SessionUtils.getUserId();
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(id);
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
Optional.ofNullable(functionalCase).ifPresent(functional -> {
functionalCaseDTO.setName(functionalCase.getName());
functionalCaseDTO.setCaseEditType(functionalCase.getCaseEditType());
functionalCaseDTO.setCreateUser(userId);
BeanUtils.copyBean(functionalCaseDTO, functionalCase);
List<OptionDTO> customFields = getCustomFields(id);
functionalCaseDTO.setFields(customFields);
});
//TODO:设置测试计划名称
//TODO设置用例评审名称
return functionalCaseDTO;
}

View File

@ -168,7 +168,7 @@ public class NoticeTemplateService {
messageTemplateFieldFollow.setName(Translator.get("message.follow_people"));
messageTemplateFieldDTOS.add(messageTemplateFieldFollow);
MessageTemplateFieldDTO messageTemplateFieldTriggerMode = new MessageTemplateFieldDTO();
messageTemplateFieldTriggerMode.setId("TRIGGER_MODE");
messageTemplateFieldTriggerMode.setId("triggerMode");
messageTemplateFieldTriggerMode.setFieldSource(NoticeConstants.FieldSource.CASE_FIELD);
messageTemplateFieldTriggerMode.setName(Translator.get("message.trigger_mode"));
messageTemplateFieldDTOS.add(messageTemplateFieldTriggerMode);

View File

@ -21,7 +21,7 @@ public class FunctionalCaseMessageDTO {
private String reviewStatus;
@Schema(description = "message.domain.case_model")
private String caseModel;
private String caseEditType;
@Schema(description = "message.domain.last_execute_result")
private String lastExecuteResult;

View File

@ -505,5 +505,6 @@ public interface NoticeConstants {
String testResourcePoolId = "testResourcePoolId";
String resourceId = "resourceId";
String platformBugId = "platformBugId";
String handleUsers = "handleUsers";
}
}