mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-05 05:29:29 +08:00
Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
587f41b962
@ -6,6 +6,7 @@ import com.dingtalk.api.request.OapiRobotSendRequest;
|
||||
import com.dingtalk.api.response.OapiRobotSendResponse;
|
||||
import com.taobao.api.ApiException;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
import io.metersphere.notice.domain.UserDetail;
|
||||
import io.metersphere.service.UserService;
|
||||
@ -62,7 +63,7 @@ public class DingTaskService {
|
||||
try {
|
||||
response = client.execute(request);
|
||||
} catch (ApiException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
System.out.println(response.getErrcode());
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.metersphere.notice.service;
|
||||
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.utils.LogUtil;
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
import io.metersphere.notice.domain.UserDetail;
|
||||
import io.metersphere.notice.message.TextMessage;
|
||||
@ -55,7 +56,7 @@ public class WxChatTaskService {
|
||||
SendResult result = WxChatbotClient.send(Webhook, message);
|
||||
System.out.println(result);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public abstract class AbstractIssuePlatform implements IssuesPlatform {
|
||||
|
||||
/**
|
||||
* 获取平台与项目相关的属性
|
||||
* @return
|
||||
* @return 其他平台和本地项目绑定的属性值
|
||||
*/
|
||||
abstract String getProjectId();
|
||||
|
||||
|
@ -9,31 +9,30 @@ public interface IssuesPlatform {
|
||||
|
||||
/**
|
||||
* 获取平台相关联的缺陷
|
||||
* @return
|
||||
* @return platform issues list
|
||||
*/
|
||||
List<Issues> getIssue();
|
||||
|
||||
/**
|
||||
* 添加缺陷到缺陷平台
|
||||
* @param issuesRequest
|
||||
* @param issuesRequest issueRequest
|
||||
*/
|
||||
void addIssue(IssuesRequest issuesRequest);
|
||||
|
||||
/**
|
||||
* 删除缺陷平台缺陷
|
||||
* @param id
|
||||
* @param id issue id
|
||||
*/
|
||||
void deleteIssue(String id);
|
||||
|
||||
/**
|
||||
* 测试缺陷平台连通性
|
||||
* @param
|
||||
* 测试平台联通性
|
||||
*/
|
||||
void testAuth();
|
||||
|
||||
/**
|
||||
* 获取缺陷平台项目下的相关人员
|
||||
* @return
|
||||
* @return platform user list
|
||||
*/
|
||||
List<PlatformUser> getPlatformUser();
|
||||
}
|
||||
|
@ -586,9 +586,14 @@ public class TestCaseNodeService {
|
||||
}
|
||||
|
||||
|
||||
// 测试用例同级模块排序
|
||||
/**
|
||||
* 测试用例同级模块排序
|
||||
* @param ids 被拖拽模块相邻的前一个模块 id,
|
||||
* 被拖拽的模块 id,
|
||||
* 被拖拽模块相邻的后一个模块 id
|
||||
*/
|
||||
public void sort(List<String> ids) {
|
||||
// 获取相邻节点
|
||||
// 获取相邻节点 id
|
||||
String before = ids.get(0);
|
||||
String id = ids.get(1);
|
||||
String after = ids.get(2);
|
||||
@ -598,6 +603,7 @@ public class TestCaseNodeService {
|
||||
|
||||
TestCaseNode caseNode = getCaseNode(id);
|
||||
|
||||
// 获取相邻节点
|
||||
if (StringUtils.isNotBlank(before)) {
|
||||
beforeCase = getCaseNode(before);
|
||||
beforeCase = beforeCase.getLevel().equals(caseNode.getLevel()) ? beforeCase : null;
|
||||
@ -625,6 +631,14 @@ public class TestCaseNodeService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照指定排序方式获取同级模块的列表
|
||||
* @param projectId 所属项目 id
|
||||
* @param level node level
|
||||
* @param parentId node parent id
|
||||
* @param order pos 排序方式
|
||||
* @return 按照指定排序方式排序的同级模块列表
|
||||
*/
|
||||
private List<TestCaseNode> getPos(String projectId, int level, String parentId, String order) {
|
||||
TestCaseNodeExample example = new TestCaseNodeExample();
|
||||
TestCaseNodeExample.Criteria criteria = example.createCriteria();
|
||||
@ -636,6 +650,12 @@ public class TestCaseNodeService {
|
||||
return testCaseNodeMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新同级模块的 pos 值
|
||||
* @param projectId project id
|
||||
* @param level node level
|
||||
* @param parentId node parent id
|
||||
*/
|
||||
private void refreshPos(String projectId, int level, String parentId) {
|
||||
List<TestCaseNode> nodes = getPos(projectId, level, parentId, "pos asc");
|
||||
if (!CollectionUtils.isEmpty(nodes)) {
|
||||
@ -650,7 +670,15 @@ public class TestCaseNodeService {
|
||||
}
|
||||
}
|
||||
|
||||
public double getNextLevelPos(String projectId, int level, String parentId) {
|
||||
|
||||
/**
|
||||
* 获得同级模块下一个 pos 值
|
||||
* @param projectId project id
|
||||
* @param level node level
|
||||
* @param parentId node parent id
|
||||
* @return 同级模块下一个 pos 值
|
||||
*/
|
||||
private double getNextLevelPos(String projectId, int level, String parentId) {
|
||||
List<TestCaseNode> list = getPos(projectId, level, parentId, "pos desc");
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
return list.get(0).getPos() + 65536;
|
||||
|
@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtTestCaseReviewMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestReviewCaseMapper;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.TestCaseReviewStatus;
|
||||
import io.metersphere.commons.constants.TestPlanStatus;
|
||||
import io.metersphere.commons.constants.TestReviewCaseStatus;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.user.SessionUser;
|
||||
@ -184,28 +185,31 @@ public class TestCaseReviewService {
|
||||
testCaseReview.setUpdateTime(System.currentTimeMillis());
|
||||
checkCaseReviewExist(testCaseReview);
|
||||
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
||||
List<String> userIds=new ArrayList<>();
|
||||
List<String> userIds = new ArrayList<>();
|
||||
userIds.addAll(testCaseReview.getUserIds());
|
||||
try {
|
||||
String context = getReviewContext(testCaseReview, NoticeConstants.CREATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendReviewerNotice(r, userIds, testCaseReview, NoticeConstants.CREATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
if (StringUtils.equals(TestPlanStatus.Completed.name(), testCaseReview.getStatus())) {
|
||||
try {
|
||||
String context = getReviewContext(testCaseReview, NoticeConstants.UPDATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendReviewerNotice(r, userIds, testCaseReview, NoticeConstants.UPDATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void editCaseReviewer(SaveTestCaseReviewRequest testCaseReview) {
|
||||
|
@ -165,20 +165,20 @@ public class TestPlanService {
|
||||
//已完成,写入实际完成时间
|
||||
testPlan.setActualEndTime(System.currentTimeMillis());
|
||||
try {
|
||||
BeanUtils.copyBean(testPlans, testPlan);
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.CREATE);
|
||||
BeanUtils.copyBean(testPlans, getTestPlan(testPlan.getId()));
|
||||
String context = getTestPlanContext(testPlans, NoticeConstants.UPDATE);
|
||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||
List<MessageDetail> taskList = messageSettingDetail.getTestCasePlanTask();
|
||||
taskList.forEach(r -> {
|
||||
switch (r.getType()) {
|
||||
case NoticeConstants.NAIL_ROBOT:
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||
break;
|
||||
case NoticeConstants.WECHAT_ROBOT:
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||
break;
|
||||
case NoticeConstants.EMAIL:
|
||||
mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.CREATE);
|
||||
mailService.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.UPDATE);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user