diff --git a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java index d796d40eed..e7a0970e09 100644 --- a/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java +++ b/backend/src/main/java/io/metersphere/track/controller/TestCaseReviewController.java @@ -21,7 +21,6 @@ import io.metersphere.track.dto.TestReviewDTOWithMetric; import io.metersphere.track.request.testreview.*; import io.metersphere.track.service.TestCaseCommentService; import io.metersphere.track.service.TestCaseReviewService; -import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestReviewProjectService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.*; @@ -157,7 +156,7 @@ public class TestCaseReviewController { @PostMapping("/comment/save") @RequiresPermissions(PermissionConstants.PROJECT_TRACK_REVIEW_READ_COMMENT) @MsAuditLog(module = OperLogModule.TRACK_TEST_CASE_REVIEW, type = OperLogConstants.CREATE, content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseCommentService.class) - @SendNotice(taskType = NoticeConstants.TaskType.REVIEW_TASK, target = "#targetClass.getTestCase(#request.caseId)", targetClass = TestCaseService.class, + @SendNotice(taskType = NoticeConstants.TaskType.REVIEW_TASK, target = "#targetClass.getTestReview(#request.reviewId)", targetClass = TestCaseReviewService.class, event = NoticeConstants.Event.COMMENT, mailTemplate = "track/TestCaseComment", subject = "测试评审通知") public TestCaseComment saveComment(@RequestBody SaveCommentRequest request) { request.setId(UUID.randomUUID().toString()); diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java index 948267d5e8..5c55d6af38 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseCommentService.java @@ -4,21 +4,15 @@ import com.alibaba.fastjson.JSON; import io.metersphere.base.domain.*; import io.metersphere.base.mapper.TestCaseCommentMapper; import io.metersphere.base.mapper.TestCaseMapper; -import io.metersphere.base.mapper.TestCaseReviewMapper; import io.metersphere.base.mapper.UserMapper; import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper; -import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.SessionUtils; -import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.i18n.Translator; import io.metersphere.log.utils.ReflexObjectUtil; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.track.TestCaseReviewReference; -import io.metersphere.notice.sender.NoticeModel; -import io.metersphere.notice.service.NoticeSendService; -import io.metersphere.service.SystemParameterService; import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.request.testreview.SaveCommentRequest; import org.apache.commons.lang3.StringUtils; @@ -27,13 +21,12 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Date; +import java.util.List; @Service @Transactional(rollbackFor = Exception.class) public class TestCaseCommentService { - @Resource - TestCaseReviewMapper testCaseReviewMapper; @Resource private TestCaseCommentMapper testCaseCommentMapper; @Resource @@ -42,10 +35,6 @@ public class TestCaseCommentService { private ExtTestCaseCommentMapper extTestCaseCommentMapper; @Resource private UserMapper userMapper; - @Resource - private NoticeSendService noticeSendService; - @Resource - private SystemParameterService systemParameterService; public TestCaseComment saveComment(SaveCommentRequest request) { TestCaseComment testCaseComment = new TestCaseComment(); @@ -57,30 +46,6 @@ public class TestCaseCommentService { testCaseComment.setDescription(request.getDescription()); testCaseComment.setStatus(request.getStatus()); testCaseCommentMapper.insert(testCaseComment); -// TestCaseWithBLOBs testCaseWithBLOBs; -// testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId()); -// -// // 发送通知 -// User user = userMapper.selectByPrimaryKey(testCaseComment.getAuthor()); -// BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); -// List userIds = new ArrayList<>(); -// userIds.add(testCaseWithBLOBs.getMaintainer());//用例维护人 -// String context = getReviewContext(testCaseComment, testCaseWithBLOBs); -// Map paramMap = new HashMap<>(); -// paramMap.put("maintainer", user.getName()); -// paramMap.put("testCaseName", testCaseWithBLOBs.getName()); -// paramMap.put("description", request.getDescription()); -// paramMap.put("url", baseSystemConfigDTO.getUrl()); -// paramMap.put("id", request.getReviewId()); -// NoticeModel noticeModel = NoticeModel.builder() -// .context(context) -// .relatedUsers(userIds) -// .subject(Translator.get("test_review_task_notice")) -// .mailTemplate("ReviewComments") -// .paramMap(paramMap) -// .event(NoticeConstants.Event.COMMENT) -// .build(); -// noticeSendService.send(NoticeConstants.TaskType.REVIEW_TASK, noticeModel); return testCaseComment; } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index b95a703992..e08c9ceceb 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -31,6 +31,7 @@ import io.metersphere.track.dto.TestCaseReviewDTO; import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewDTOWithMetric; import io.metersphere.track.request.testreview.*; +import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -118,38 +119,11 @@ public class TestCaseReviewService { } //评审内容 - private Map getReviewParamMap(SaveTestCaseReviewRequest reviewRequest) { - Long startTime = reviewRequest.getCreateTime(); - Long endTime = reviewRequest.getEndTime(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String start = null; - String sTime = String.valueOf(startTime); - String eTime = String.valueOf(endTime); - if (!sTime.equals("null")) { - start = sdf.format(new Date(Long.parseLong(sTime))); - } - String end = null; - if (!eTime.equals("null")) { - end = sdf.format(new Date(Long.parseLong(eTime))); - } - - Map paramMap = new HashMap<>(); + private Map getReviewParamMap(TestCaseReview review) { + Map paramMap = new HashMap<>(); BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo(); paramMap.put("url", baseSystemConfigDTO.getUrl()); - paramMap.put("creator", reviewRequest.getCreator()); - paramMap.put("name", reviewRequest.getName()); - paramMap.put("start", start); - paramMap.put("end", end); - paramMap.put("id", reviewRequest.getId()); - String status = ""; - if (StringUtils.equals(TestPlanStatus.Underway.name(), reviewRequest.getStatus())) { - status = "进行中"; - } else if (StringUtils.equals(TestPlanStatus.Prepare.name(), reviewRequest.getStatus())) { - status = "未开始"; - } else if (StringUtils.equals(TestPlanStatus.Completed.name(), reviewRequest.getStatus())) { - status = "已完成"; - } - paramMap.put("status", status); + paramMap.putAll(new BeanMap(review)); return paramMap; } @@ -439,7 +413,7 @@ public class TestCaseReviewService { try { BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview); String context = getReviewContext(testCaseReviewRequest, NoticeConstants.Event.UPDATE); - Map paramMap = new HashMap<>(getReviewParamMap(testCaseReviewRequest)); + Map paramMap = new HashMap<>(getReviewParamMap(_testCaseReview)); paramMap.put("operator", SessionUtils.getUser().getName()); NoticeModel noticeModel = NoticeModel.builder() .operator(SessionUtils.getUserId()) diff --git a/frontend/src/business/components/settings/workspace/components/track/TestReviewNotification.vue b/frontend/src/business/components/settings/workspace/components/track/TestReviewNotification.vue index d7c69a3b67..d08ca1c9fc 100644 --- a/frontend/src/business/components/settings/workspace/components/track/TestReviewNotification.vue +++ b/frontend/src/business/components/settings/workspace/components/track/TestReviewNotification.vue @@ -190,10 +190,6 @@ export default { label:this.$t('commons.name'), value:'name', }, - { - label:this.$t('commons.create_user'), - value:'creator', - }, { label:this.$t('commons.status'), value:'status',