fix: 修复冲突

This commit is contained in:
wenyann 2020-09-25 11:40:53 +08:00
parent e145abc57e
commit b9f4fa628b
2 changed files with 25 additions and 15 deletions

View File

@ -11,6 +11,7 @@ import io.metersphere.base.mapper.UserMapper;
import io.metersphere.commons.utils.SessionUtils; import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.notice.service.MailService; import io.metersphere.notice.service.MailService;
import io.metersphere.track.request.testreview.SaveCommentRequest; import io.metersphere.track.request.testreview.SaveCommentRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -45,9 +46,10 @@ public class TestCaseCommentService {
testCaseCommentMapper.insert(testCaseComment); testCaseCommentMapper.insert(testCaseComment);
TestCaseWithBLOBs testCaseWithBLOBs; TestCaseWithBLOBs testCaseWithBLOBs;
testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId()); testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(request.getCaseId());
SaveTestCaseReviewRequest caseReviewRequest = new SaveTestCaseReviewRequest();
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.add(testCaseWithBLOBs.getMaintainer()); userIds.add(testCaseWithBLOBs.getMaintainer());
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs); mailService.sendHtml(userIds, "comment", caseReviewRequest, request, testCaseWithBLOBs);
} }

View File

@ -20,10 +20,7 @@ import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseReviewDTO; import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric; import io.metersphere.track.dto.TestReviewDTOWithMetric;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest; import io.metersphere.track.request.testreview.*;
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.ExecutorType; import org.apache.ibatis.session.ExecutorType;
@ -34,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.InvocationTargetException;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -96,7 +94,10 @@ public class TestCaseReviewService {
reviewRequest.setCreator(SessionUtils.getUser().getId()); reviewRequest.setCreator(SessionUtils.getUser().getId());
reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name()); reviewRequest.setStatus(TestCaseReviewStatus.Prepare.name());
testCaseReviewMapper.insert(reviewRequest); testCaseReviewMapper.insert(reviewRequest);
mailService.sendReviewerNotice(userIds, reviewRequest); SaveCommentRequest request = new SaveCommentRequest();
TestCaseWithBLOBs testCaseWithBLOBs = new TestCaseWithBLOBs();
mailService.sendHtml(userIds, "reviewer", reviewRequest, request, testCaseWithBLOBs);
} }
public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) { public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) {
@ -146,13 +147,15 @@ public class TestCaseReviewService {
return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId); return extTestCaseReviewMapper.listByWorkspaceId(currentWorkspaceId);
} }
public void editCaseReview(SaveTestCaseReviewRequest reviewRequest) { public void editCaseReview(SaveTestCaseReviewRequest testCaseReview) {
editCaseReviewer(reviewRequest); editCaseReviewer(testCaseReview);
editCaseReviewProject(reviewRequest); editCaseReviewProject(testCaseReview);
reviewRequest.setUpdateTime(System.currentTimeMillis()); testCaseReview.setUpdateTime(System.currentTimeMillis());
checkCaseReviewExist(reviewRequest); checkCaseReviewExist(testCaseReview);
testCaseReviewMapper.updateByPrimaryKeySelective(reviewRequest); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
mailService.sendReviewerNotice(reviewRequest.getUserIds(), reviewRequest); SaveCommentRequest request = new SaveCommentRequest();
TestCaseWithBLOBs testCaseWithBLOBs = new TestCaseWithBLOBs();
mailService.sendHtml(testCaseReview.getUserIds(), "reviewer", testCaseReview, request, testCaseWithBLOBs);
} }
private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) { private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) {
@ -339,16 +342,21 @@ public class TestCaseReviewService {
} }
} }
testCaseReview.setStatus(TestPlanStatus.Completed.name()); testCaseReview.setStatus(TestPlanStatus.Completed.name());
SaveCommentRequest request = new SaveCommentRequest();
TestCaseWithBLOBs testCaseWithBLOBs = new TestCaseWithBLOBs();
SaveTestCaseReviewRequest testCaseReviewRequest = new SaveTestCaseReviewRequest(); SaveTestCaseReviewRequest testCaseReviewRequest = new SaveTestCaseReviewRequest();
TestCaseReview _testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId); TestCaseReview _testCaseReview = testCaseReviewMapper.selectByPrimaryKey(reviewId);
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.add(_testCaseReview.getCreator()); userIds.add(_testCaseReview.getCreator());
try { try {
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview); BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
} catch (Exception e) { } catch (IllegalAccessException e) {
LogUtil.error(e);
} catch (InvocationTargetException e) {
LogUtil.error(e); LogUtil.error(e);
} }
mailService.sendEndNotice(userIds, testCaseReviewRequest); mailService.sendHtml(userIds, "end", testCaseReviewRequest, request, testCaseWithBLOBs);
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
} }