fix: 修复测试计划,钉钉提示语为空,修改日志

This commit is contained in:
wenyann 2020-11-02 16:51:06 +08:00
parent b749f6277b
commit 352d464ca6
4 changed files with 34 additions and 28 deletions

View File

@ -6,6 +6,7 @@ import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse; import com.dingtalk.api.response.OapiRobotSendResponse;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.domain.UserDetail; import io.metersphere.notice.domain.UserDetail;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
@ -62,7 +63,7 @@ public class DingTaskService {
try { try {
response = client.execute(request); response = client.execute(request);
} catch (ApiException e) { } catch (ApiException e) {
e.printStackTrace(); LogUtil.error(e);
} }
System.out.println(response.getErrcode()); System.out.println(response.getErrcode());
} }

View File

@ -1,6 +1,7 @@
package io.metersphere.notice.service; package io.metersphere.notice.service;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.notice.domain.MessageDetail; import io.metersphere.notice.domain.MessageDetail;
import io.metersphere.notice.domain.UserDetail; import io.metersphere.notice.domain.UserDetail;
import io.metersphere.notice.message.TextMessage; import io.metersphere.notice.message.TextMessage;
@ -55,7 +56,7 @@ public class WxChatTaskService {
SendResult result = WxChatbotClient.send(Webhook, message); SendResult result = WxChatbotClient.send(Webhook, message);
System.out.println(result); System.out.println(result);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); LogUtil.error(e);
} }
} }

View File

@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper; import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
import io.metersphere.commons.constants.NoticeConstants; import io.metersphere.commons.constants.NoticeConstants;
import io.metersphere.commons.constants.TestCaseReviewStatus; import io.metersphere.commons.constants.TestCaseReviewStatus;
import io.metersphere.commons.constants.TestPlanStatus;
import io.metersphere.commons.constants.TestReviewCaseStatus; import io.metersphere.commons.constants.TestReviewCaseStatus;
import io.metersphere.commons.exception.MSException; import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser; import io.metersphere.commons.user.SessionUser;
@ -184,22 +185,23 @@ public class TestCaseReviewService {
testCaseReview.setUpdateTime(System.currentTimeMillis()); testCaseReview.setUpdateTime(System.currentTimeMillis());
checkCaseReviewExist(testCaseReview); checkCaseReviewExist(testCaseReview);
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview); testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
List<String> userIds=new ArrayList<>(); List<String> userIds = new ArrayList<>();
userIds.addAll(testCaseReview.getUserIds()); userIds.addAll(testCaseReview.getUserIds());
if (StringUtils.equals(TestPlanStatus.Completed.name(), testCaseReview.getStatus())) {
try { try {
String context = getReviewContext(testCaseReview, NoticeConstants.CREATE); String context = getReviewContext(testCaseReview, NoticeConstants.UPDATE);
MessageSettingDetail messageSettingDetail = noticeService.searchMessage(); MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
List<MessageDetail> taskList = messageSettingDetail.getReviewTask(); List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
taskList.forEach(r -> { taskList.forEach(r -> {
switch (r.getType()) { switch (r.getType()) {
case NoticeConstants.NAIL_ROBOT: case NoticeConstants.NAIL_ROBOT:
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE); dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.UPDATE);
break; break;
case NoticeConstants.WECHAT_ROBOT: case NoticeConstants.WECHAT_ROBOT:
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE); wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
break; break;
case NoticeConstants.EMAIL: case NoticeConstants.EMAIL:
mailService.sendReviewerNotice(r, userIds, testCaseReview, NoticeConstants.CREATE); mailService.sendReviewerNotice(r, userIds, testCaseReview, NoticeConstants.UPDATE);
break; break;
} }
}); });
@ -208,6 +210,8 @@ public class TestCaseReviewService {
} }
} }
}
private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) { private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) {
// 要更新的reviewerIds // 要更新的reviewerIds
List<String> reviewerIds = testCaseReview.getUserIds(); List<String> reviewerIds = testCaseReview.getUserIds();

View File

@ -165,20 +165,20 @@ public class TestPlanService {
//已完成写入实际完成时间 //已完成写入实际完成时间
testPlan.setActualEndTime(System.currentTimeMillis()); testPlan.setActualEndTime(System.currentTimeMillis());
try { try {
BeanUtils.copyBean(testPlans, testPlan); BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
String context = getTestPlanContext(testPlans, NoticeConstants.CREATE); String context = getTestPlanContext(testPlans, NoticeConstants.UPDATE);
MessageSettingDetail messageSettingDetail = noticeService.searchMessage(); MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
List<MessageDetail> taskList = messageSettingDetail.getReviewTask(); List<MessageDetail> taskList = messageSettingDetail.getTestCasePlanTask();
taskList.forEach(r -> { taskList.forEach(r -> {
switch (r.getType()) { switch (r.getType()) {
case NoticeConstants.NAIL_ROBOT: case NoticeConstants.NAIL_ROBOT:
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE); dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.UPDATE);
break; break;
case NoticeConstants.WECHAT_ROBOT: case NoticeConstants.WECHAT_ROBOT:
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE); wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
break; break;
case NoticeConstants.EMAIL: case NoticeConstants.EMAIL:
mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.CREATE); mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.UPDATE);
break; break;
} }
}); });