Merge branch 'v1.4' of https://github.com/metersphere/server into v1.4
This commit is contained in:
commit
b1baa5d493
|
@ -5,12 +5,17 @@ import io.metersphere.api.service.APITestService;
|
||||||
import io.metersphere.base.domain.ApiTestReport;
|
import io.metersphere.base.domain.ApiTestReport;
|
||||||
import io.metersphere.commons.constants.APITestStatus;
|
import io.metersphere.commons.constants.APITestStatus;
|
||||||
import io.metersphere.commons.constants.ApiRunMode;
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.CommonBeanFactory;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
|
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||||
import io.metersphere.notice.domain.NoticeDetail;
|
import io.metersphere.notice.domain.NoticeDetail;
|
||||||
|
import io.metersphere.notice.service.DingTaskService;
|
||||||
import io.metersphere.notice.service.MailService;
|
import io.metersphere.notice.service.MailService;
|
||||||
import io.metersphere.notice.service.NoticeService;
|
import io.metersphere.notice.service.NoticeService;
|
||||||
|
import io.metersphere.notice.service.WxChatTaskService;
|
||||||
import io.metersphere.track.service.TestPlanTestCaseService;
|
import io.metersphere.track.service.TestPlanTestCaseService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.jmeter.assertions.AssertionResult;
|
import org.apache.jmeter.assertions.AssertionResult;
|
||||||
|
@ -19,6 +24,7 @@ import org.apache.jmeter.visualizers.backend.AbstractBackendListenerClient;
|
||||||
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
|
import org.apache.jmeter.visualizers.backend.BackendListenerContext;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
|
|
||||||
|
import javax.mail.MessagingException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -79,6 +85,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
||||||
super.setupTest(context);
|
super.setupTest(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleSampleResults(List<SampleResult> sampleResults, BackendListenerContext context) {
|
public void handleSampleResults(List<SampleResult> sampleResults, BackendListenerContext context) {
|
||||||
queue.addAll(sampleResults);
|
queue.addAll(sampleResults);
|
||||||
|
@ -139,6 +146,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
||||||
queue.clear();
|
queue.clear();
|
||||||
super.teardownTest(context);
|
super.teardownTest(context);
|
||||||
|
|
||||||
|
TestPlanTestCaseService testPlanTestCaseService = CommonBeanFactory.getBean(TestPlanTestCaseService.class);
|
||||||
List<String> ids = testPlanTestCaseService.getTestPlanTestCaseIds(testResult.getTestId());
|
List<String> ids = testPlanTestCaseService.getTestPlanTestCaseIds(testResult.getTestId());
|
||||||
if (ids.size() > 0) {
|
if (ids.size() > 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -152,15 +160,79 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<NoticeDetail> noticeList = noticeService.queryNotice(testResult.getTestId());
|
sendTask(report, testResult);
|
||||||
mailService.sendApiNotification(report, noticeList);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void sendTask(ApiTestReport report, TestResult testResult) {
|
||||||
|
NoticeService noticeService = CommonBeanFactory.getBean(NoticeService.class);
|
||||||
|
MailService mailService = CommonBeanFactory.getBean(MailService.class);
|
||||||
|
DingTaskService dingTaskService = CommonBeanFactory.getBean(DingTaskService.class);
|
||||||
|
WxChatTaskService wxChatTaskService = CommonBeanFactory.getBean(WxChatTaskService.class);
|
||||||
|
if (StringUtils.equals(NoticeConstants.SCHEDULE, report.getTriggerMode())) {
|
||||||
|
List<NoticeDetail> noticeList = noticeService.queryNotice(testResult.getTestId());
|
||||||
|
mailService.sendApiNotification(report, noticeList);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.API, report.getTriggerMode())) {
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||||
|
List<MessageDetail> taskList = messageSettingDetail.getJenkinsTask();
|
||||||
|
if (StringUtils.equals(report.getStatus(), "Success")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
String contextSuccess = report.getName() + "执行成功";
|
||||||
|
;
|
||||||
|
String contextFailed = report.getName() + "执行失败";
|
||||||
|
taskList.forEach(r -> {
|
||||||
|
switch (r.getType()) {
|
||||||
|
case NoticeConstants.NAIL_ROBOT:
|
||||||
|
r.getEvents().forEach(e -> {
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||||
|
dingTaskService.sendNailRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||||
|
dingTaskService.sendNailRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
|
r.getEvents().forEach(e -> {
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||||
|
wxChatTaskService.sendWechatRobot(r, userIds, contextSuccess, NoticeConstants.EXECUTE_SUCCESSFUL);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||||
|
wxChatTaskService.sendWechatRobot(r, userIds, contextFailed, NoticeConstants.EXECUTE_FAILED);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case NoticeConstants.EMAIL:
|
||||||
|
r.getEvents().forEach(e -> {
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_SUCCESSFUL, e) && StringUtils.equals(report.getStatus(), "Success")) {
|
||||||
|
try {
|
||||||
|
mailService.sendApiJenkinsNotification(contextSuccess, r);
|
||||||
|
} catch (MessagingException messagingException) {
|
||||||
|
messagingException.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.EXECUTE_FAILED, e) && StringUtils.equals(report.getStatus(), "Error")) {
|
||||||
|
try {
|
||||||
|
mailService.sendApiJenkinsNotification(contextFailed, r);
|
||||||
|
} catch (MessagingException messagingException) {
|
||||||
|
messagingException.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private RequestResult getRequestResult(SampleResult result) {
|
private RequestResult getRequestResult(SampleResult result) {
|
||||||
RequestResult requestResult = new RequestResult();
|
RequestResult requestResult = new RequestResult();
|
||||||
requestResult.setName(result.getSampleLabel());
|
requestResult.setName(result.getSampleLabel());
|
||||||
|
|
|
@ -595,62 +595,62 @@ public class MessageTaskExample {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetIsNull() {
|
public Criteria andIsSetIsNull() {
|
||||||
addCriterion("is_Set is null");
|
addCriterion("is_set is null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetIsNotNull() {
|
public Criteria andIsSetIsNotNull() {
|
||||||
addCriterion("is_Set is not null");
|
addCriterion("is_set is not null");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetEqualTo(Boolean value) {
|
public Criteria andIsSetEqualTo(Boolean value) {
|
||||||
addCriterion("is_Set =", value, "isSet");
|
addCriterion("is_set =", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetNotEqualTo(Boolean value) {
|
public Criteria andIsSetNotEqualTo(Boolean value) {
|
||||||
addCriterion("is_Set <>", value, "isSet");
|
addCriterion("is_set <>", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetGreaterThan(Boolean value) {
|
public Criteria andIsSetGreaterThan(Boolean value) {
|
||||||
addCriterion("is_Set >", value, "isSet");
|
addCriterion("is_set >", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetGreaterThanOrEqualTo(Boolean value) {
|
public Criteria andIsSetGreaterThanOrEqualTo(Boolean value) {
|
||||||
addCriterion("is_Set >=", value, "isSet");
|
addCriterion("is_set >=", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetLessThan(Boolean value) {
|
public Criteria andIsSetLessThan(Boolean value) {
|
||||||
addCriterion("is_Set <", value, "isSet");
|
addCriterion("is_set <", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetLessThanOrEqualTo(Boolean value) {
|
public Criteria andIsSetLessThanOrEqualTo(Boolean value) {
|
||||||
addCriterion("is_Set <=", value, "isSet");
|
addCriterion("is_set <=", value, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetIn(List<Boolean> values) {
|
public Criteria andIsSetIn(List<Boolean> values) {
|
||||||
addCriterion("is_Set in", values, "isSet");
|
addCriterion("is_set in", values, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetNotIn(List<Boolean> values) {
|
public Criteria andIsSetNotIn(List<Boolean> values) {
|
||||||
addCriterion("is_Set not in", values, "isSet");
|
addCriterion("is_set not in", values, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetBetween(Boolean value1, Boolean value2) {
|
public Criteria andIsSetBetween(Boolean value1, Boolean value2) {
|
||||||
addCriterion("is_Set between", value1, value2, "isSet");
|
addCriterion("is_set between", value1, value2, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Criteria andIsSetNotBetween(Boolean value1, Boolean value2) {
|
public Criteria andIsSetNotBetween(Boolean value1, Boolean value2) {
|
||||||
addCriterion("is_Set not between", value1, value2, "isSet");
|
addCriterion("is_set not between", value1, value2, "isSet");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package io.metersphere.base.domain;
|
package io.metersphere.base.domain;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TestPlan implements Serializable {
|
public class TestPlan implements Serializable {
|
||||||
private String id;
|
private String id;
|
||||||
|
@ -25,17 +26,19 @@ public class TestPlan implements Serializable {
|
||||||
|
|
||||||
private String executorMatchRule;
|
private String executorMatchRule;
|
||||||
|
|
||||||
|
private Long createTime;
|
||||||
|
|
||||||
|
private Long updateTime;
|
||||||
|
|
||||||
|
private Long actualEndTime;
|
||||||
|
|
||||||
private Long plannedStartTime;
|
private Long plannedStartTime;
|
||||||
|
|
||||||
private Long plannedEndTime;
|
private Long plannedEndTime;
|
||||||
|
|
||||||
private Long actualStartTime;
|
private Long actualStartTime;
|
||||||
|
|
||||||
private Long actualEndTime;
|
private String creator;
|
||||||
|
|
||||||
private Long createTime;
|
|
||||||
|
|
||||||
private Long updateTime;
|
|
||||||
|
|
||||||
private String tags;
|
private String tags;
|
||||||
|
|
||||||
|
|
|
@ -923,6 +923,316 @@ public class TestPlanExample {
|
||||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||||
return (Criteria) this;
|
return (Criteria) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeIsNull() {
|
||||||
|
addCriterion("actual_end_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeIsNotNull() {
|
||||||
|
addCriterion("actual_end_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeEqualTo(Long value) {
|
||||||
|
addCriterion("actual_end_time =", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("actual_end_time <>", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("actual_end_time >", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("actual_end_time >=", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeLessThan(Long value) {
|
||||||
|
addCriterion("actual_end_time <", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("actual_end_time <=", value, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeIn(List<Long> values) {
|
||||||
|
addCriterion("actual_end_time in", values, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("actual_end_time not in", values, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("actual_end_time between", value1, value2, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualEndTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("actual_end_time not between", value1, value2, "actualEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeIsNull() {
|
||||||
|
addCriterion("planned_start_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeIsNotNull() {
|
||||||
|
addCriterion("planned_start_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeEqualTo(Long value) {
|
||||||
|
addCriterion("planned_start_time =", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("planned_start_time <>", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("planned_start_time >", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("planned_start_time >=", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeLessThan(Long value) {
|
||||||
|
addCriterion("planned_start_time <", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("planned_start_time <=", value, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeIn(List<Long> values) {
|
||||||
|
addCriterion("planned_start_time in", values, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("planned_start_time not in", values, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("planned_start_time between", value1, value2, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedStartTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("planned_start_time not between", value1, value2, "plannedStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeIsNull() {
|
||||||
|
addCriterion("planned_end_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeIsNotNull() {
|
||||||
|
addCriterion("planned_end_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeEqualTo(Long value) {
|
||||||
|
addCriterion("planned_end_time =", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("planned_end_time <>", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("planned_end_time >", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("planned_end_time >=", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeLessThan(Long value) {
|
||||||
|
addCriterion("planned_end_time <", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("planned_end_time <=", value, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeIn(List<Long> values) {
|
||||||
|
addCriterion("planned_end_time in", values, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("planned_end_time not in", values, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("planned_end_time between", value1, value2, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andPlannedEndTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("planned_end_time not between", value1, value2, "plannedEndTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeIsNull() {
|
||||||
|
addCriterion("actual_start_time is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeIsNotNull() {
|
||||||
|
addCriterion("actual_start_time is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeEqualTo(Long value) {
|
||||||
|
addCriterion("actual_start_time =", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeNotEqualTo(Long value) {
|
||||||
|
addCriterion("actual_start_time <>", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeGreaterThan(Long value) {
|
||||||
|
addCriterion("actual_start_time >", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeGreaterThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("actual_start_time >=", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeLessThan(Long value) {
|
||||||
|
addCriterion("actual_start_time <", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeLessThanOrEqualTo(Long value) {
|
||||||
|
addCriterion("actual_start_time <=", value, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeIn(List<Long> values) {
|
||||||
|
addCriterion("actual_start_time in", values, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeNotIn(List<Long> values) {
|
||||||
|
addCriterion("actual_start_time not in", values, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("actual_start_time between", value1, value2, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andActualStartTimeNotBetween(Long value1, Long value2) {
|
||||||
|
addCriterion("actual_start_time not between", value1, value2, "actualStartTime");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorIsNull() {
|
||||||
|
addCriterion("creator is null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorIsNotNull() {
|
||||||
|
addCriterion("creator is not null");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorEqualTo(String value) {
|
||||||
|
addCriterion("creator =", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorNotEqualTo(String value) {
|
||||||
|
addCriterion("creator <>", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorGreaterThan(String value) {
|
||||||
|
addCriterion("creator >", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorGreaterThanOrEqualTo(String value) {
|
||||||
|
addCriterion("creator >=", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorLessThan(String value) {
|
||||||
|
addCriterion("creator <", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorLessThanOrEqualTo(String value) {
|
||||||
|
addCriterion("creator <=", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorLike(String value) {
|
||||||
|
addCriterion("creator like", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorNotLike(String value) {
|
||||||
|
addCriterion("creator not like", value, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorIn(List<String> values) {
|
||||||
|
addCriterion("creator in", values, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorNotIn(List<String> values) {
|
||||||
|
addCriterion("creator not in", values, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorBetween(String value1, String value2) {
|
||||||
|
addCriterion("creator between", value1, value2, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Criteria andCreatorNotBetween(String value1, String value2) {
|
||||||
|
addCriterion("creator not between", value1, value2, "creator");
|
||||||
|
return (Criteria) this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Criteria extends GeneratedCriteria {
|
public static class Criteria extends GeneratedCriteria {
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
|
<result column="task_type" jdbcType="VARCHAR" property="taskType" />
|
||||||
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
|
<result column="webhook" jdbcType="VARCHAR" property="webhook" />
|
||||||
<result column="identification" jdbcType="VARCHAR" property="identification" />
|
<result column="identification" jdbcType="VARCHAR" property="identification" />
|
||||||
<result column="is_Set" jdbcType="BIT" property="isSet" />
|
<result column="is_set" jdbcType="BIT" property="isSet"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Example_Where_Clause">
|
<sql id="Example_Where_Clause">
|
||||||
<where>
|
<where>
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, `type`, event, user_id, task_type, webhook, identification, is_Set
|
id, `type`, event, user_id, task_type, webhook, identification, is_set
|
||||||
</sql>
|
</sql>
|
||||||
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
|
<select id="selectByExample" parameterType="io.metersphere.base.domain.MessageTaskExample" resultMap="BaseResultMap">
|
||||||
select
|
select
|
||||||
|
@ -103,12 +103,12 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
|
<insert id="insert" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
insert into message_task (id, `type`, event,
|
insert into message_task (id, `type`, event,
|
||||||
user_id, task_type, webhook,
|
user_id, task_type, webhook,
|
||||||
identification, is_Set)
|
identification, is_set)
|
||||||
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{event,jdbcType=VARCHAR},
|
||||||
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
#{userId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{webhook,jdbcType=VARCHAR},
|
||||||
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT})
|
#{identification,jdbcType=VARCHAR}, #{isSet,jdbcType=BIT})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
insert into message_task
|
insert into message_task
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
identification,
|
identification,
|
||||||
</if>
|
</if>
|
||||||
<if test="isSet != null">
|
<if test="isSet != null">
|
||||||
is_Set,
|
is_set,
|
||||||
</if>
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
identification = #{record.identification,jdbcType=VARCHAR},
|
identification = #{record.identification,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.isSet != null">
|
<if test="record.isSet != null">
|
||||||
is_Set = #{record.isSet,jdbcType=BIT},
|
is_set = #{record.isSet,jdbcType=BIT},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
|
@ -206,13 +206,13 @@
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update message_task
|
update message_task
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
`type` = #{record.type,jdbcType=VARCHAR},
|
`type` = #{record.type,jdbcType=VARCHAR},
|
||||||
event = #{record.event,jdbcType=VARCHAR},
|
event = #{record.event,jdbcType=VARCHAR},
|
||||||
user_id = #{record.userId,jdbcType=VARCHAR},
|
user_id = #{record.userId,jdbcType=VARCHAR},
|
||||||
task_type = #{record.taskType,jdbcType=VARCHAR},
|
task_type = #{record.taskType,jdbcType=VARCHAR},
|
||||||
webhook = #{record.webhook,jdbcType=VARCHAR},
|
webhook = #{record.webhook,jdbcType=VARCHAR},
|
||||||
identification = #{record.identification,jdbcType=VARCHAR},
|
identification = #{record.identification,jdbcType=VARCHAR},
|
||||||
is_Set = #{record.isSet,jdbcType=BIT}
|
is_set = #{record.isSet,jdbcType=BIT}
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
|
@ -239,20 +239,20 @@
|
||||||
identification = #{identification,jdbcType=VARCHAR},
|
identification = #{identification,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="isSet != null">
|
<if test="isSet != null">
|
||||||
is_Set = #{isSet,jdbcType=BIT},
|
is_set = #{isSet,jdbcType=BIT},
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.MessageTask">
|
||||||
update message_task
|
update message_task
|
||||||
set `type` = #{type,jdbcType=VARCHAR},
|
set `type` = #{type,jdbcType=VARCHAR},
|
||||||
event = #{event,jdbcType=VARCHAR},
|
event = #{event,jdbcType=VARCHAR},
|
||||||
user_id = #{userId,jdbcType=VARCHAR},
|
user_id = #{userId,jdbcType=VARCHAR},
|
||||||
task_type = #{taskType,jdbcType=VARCHAR},
|
task_type = #{taskType,jdbcType=VARCHAR},
|
||||||
webhook = #{webhook,jdbcType=VARCHAR},
|
webhook = #{webhook,jdbcType=VARCHAR},
|
||||||
identification = #{identification,jdbcType=VARCHAR},
|
identification = #{identification,jdbcType=VARCHAR},
|
||||||
is_Set = #{isSet,jdbcType=BIT}
|
is_set = #{isSet,jdbcType=BIT}
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -2,22 +2,23 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="io.metersphere.base.mapper.TestPlanMapper">
|
<mapper namespace="io.metersphere.base.mapper.TestPlanMapper">
|
||||||
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlan">
|
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestPlan">
|
||||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||||
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
|
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId"/>
|
||||||
<result column="report_id" jdbcType="VARCHAR" property="reportId" />
|
<result column="report_id" jdbcType="VARCHAR" property="reportId"/>
|
||||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||||
<result column="description" jdbcType="VARCHAR" property="description" />
|
<result column="description" jdbcType="VARCHAR" property="description"/>
|
||||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
<result column="status" jdbcType="VARCHAR" property="status"/>
|
||||||
<result column="stage" jdbcType="VARCHAR" property="stage" />
|
<result column="stage" jdbcType="VARCHAR" property="stage"/>
|
||||||
<result column="principal" jdbcType="VARCHAR" property="principal" />
|
<result column="principal" jdbcType="VARCHAR" property="principal"/>
|
||||||
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule" />
|
<result column="test_case_match_rule" jdbcType="VARCHAR" property="testCaseMatchRule"/>
|
||||||
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule" />
|
<result column="executor_match_rule" jdbcType="VARCHAR" property="executorMatchRule"/>
|
||||||
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime" />
|
<result column="create_time" jdbcType="BIGINT" property="createTime"/>
|
||||||
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime" />
|
<result column="update_time" jdbcType="BIGINT" property="updateTime"/>
|
||||||
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime" />
|
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime"/>
|
||||||
<result column="actual_end_time" jdbcType="BIGINT" property="actualEndTime" />
|
<result column="planned_start_time" jdbcType="BIGINT" property="plannedStartTime"/>
|
||||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
<result column="planned_end_time" jdbcType="BIGINT" property="plannedEndTime"/>
|
||||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
<result column="actual_start_time" jdbcType="BIGINT" property="actualStartTime"/>
|
||||||
|
<result column="creator" jdbcType="VARCHAR" property="creator"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlan">
|
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlan">
|
||||||
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
|
<result column="tags" jdbcType="LONGVARCHAR" property="tags" />
|
||||||
|
@ -81,8 +82,9 @@
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
|
id, workspace_id, report_id, `name`, description, `status`, stage, principal, test_case_match_rule,
|
||||||
executor_match_rule, planned_start_time, planned_end_time, actual_start_time, actual_end_time, create_time, update_time
|
executor_match_rule, create_time, update_time, actual_end_time, planned_start_time,
|
||||||
|
planned_end_time, actual_start_time, creator
|
||||||
</sql>
|
</sql>
|
||||||
<sql id="Blob_Column_List">
|
<sql id="Blob_Column_List">
|
||||||
tags
|
tags
|
||||||
|
@ -118,8 +120,8 @@
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||||
select
|
select
|
||||||
<include refid="Base_Column_List" />
|
<include refid="Base_Column_List" />
|
||||||
,
|
,
|
||||||
<include refid="Blob_Column_List" />
|
<include refid="Blob_Column_List" />
|
||||||
from test_plan
|
from test_plan
|
||||||
|
@ -136,16 +138,18 @@
|
||||||
</if>
|
</if>
|
||||||
</delete>
|
</delete>
|
||||||
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
|
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlan">
|
||||||
insert into test_plan (id, workspace_id, report_id,
|
insert into test_plan (id, workspace_id, report_id,
|
||||||
`name`, description, `status`,
|
`name`, description, `status`,
|
||||||
stage, principal, test_case_match_rule,
|
stage, principal, test_case_match_rule,
|
||||||
executor_match_rule, planned_start_time, planned_end_time, create_time,
|
executor_match_rule, create_time, update_time,
|
||||||
update_time, tags)
|
actual_end_time, planned_start_time, planned_end_time,
|
||||||
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
actual_start_time, creator, tags)
|
||||||
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR},
|
||||||
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
|
#{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
||||||
#{executorMatchRule,jdbcType=VARCHAR}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
|
#{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{tags,jdbcType=LONGVARCHAR})
|
#{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||||
|
#{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT},
|
||||||
|
#{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{tags,jdbcType=LONGVARCHAR})
|
||||||
</insert>
|
</insert>
|
||||||
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
|
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlan">
|
||||||
insert into test_plan
|
insert into test_plan
|
||||||
|
@ -169,32 +173,41 @@
|
||||||
`status`,
|
`status`,
|
||||||
</if>
|
</if>
|
||||||
<if test="stage != null">
|
<if test="stage != null">
|
||||||
stage,
|
stage,
|
||||||
</if>
|
|
||||||
<if test="principal != null">
|
|
||||||
principal,
|
|
||||||
</if>
|
|
||||||
<if test="testCaseMatchRule != null">
|
|
||||||
test_case_match_rule,
|
|
||||||
</if>
|
|
||||||
<if test="executorMatchRule != null">
|
|
||||||
executor_match_rule,
|
|
||||||
</if>
|
|
||||||
<if test="plannedStartTime != null">
|
|
||||||
planned_start_time,
|
|
||||||
</if>
|
|
||||||
<if test="plannedEndTime != null">
|
|
||||||
planned_end_time,
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
create_time,
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time,
|
|
||||||
</if>
|
|
||||||
<if test="tags != null">
|
|
||||||
tags,
|
|
||||||
</if>
|
</if>
|
||||||
|
<if test="principal != null">
|
||||||
|
principal,
|
||||||
|
</if>
|
||||||
|
<if test="testCaseMatchRule != null">
|
||||||
|
test_case_match_rule,
|
||||||
|
</if>
|
||||||
|
<if test="executorMatchRule != null">
|
||||||
|
executor_match_rule,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
<if test="actualEndTime != null">
|
||||||
|
actual_end_time,
|
||||||
|
</if>
|
||||||
|
<if test="plannedStartTime != null">
|
||||||
|
planned_start_time,
|
||||||
|
</if>
|
||||||
|
<if test="plannedEndTime != null">
|
||||||
|
planned_end_time,
|
||||||
|
</if>
|
||||||
|
<if test="actualStartTime != null">
|
||||||
|
actual_start_time,
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
creator,
|
||||||
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags,
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="id != null">
|
<if test="id != null">
|
||||||
|
@ -216,32 +229,41 @@
|
||||||
#{status,jdbcType=VARCHAR},
|
#{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="stage != null">
|
<if test="stage != null">
|
||||||
#{stage,jdbcType=VARCHAR},
|
#{stage,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="principal != null">
|
|
||||||
#{principal,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="testCaseMatchRule != null">
|
|
||||||
#{testCaseMatchRule,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="executorMatchRule != null">
|
|
||||||
#{executorMatchRule,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="plannedStartTime != null">
|
|
||||||
#{plannedStartTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="plannedEndTime != null">
|
|
||||||
#{plannedEndTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
#{createTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
#{updateTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="tags != null">
|
|
||||||
#{tags,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
</if>
|
||||||
|
<if test="principal != null">
|
||||||
|
#{principal,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="testCaseMatchRule != null">
|
||||||
|
#{testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="executorMatchRule != null">
|
||||||
|
#{executorMatchRule,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actualEndTime != null">
|
||||||
|
#{actualEndTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="plannedStartTime != null">
|
||||||
|
#{plannedStartTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="plannedEndTime != null">
|
||||||
|
#{plannedEndTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actualStartTime != null">
|
||||||
|
#{actualStartTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
#{creator,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
#{tags,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanExample" resultType="java.lang.Long">
|
<select id="countByExample" parameterType="io.metersphere.base.domain.TestPlanExample" resultType="java.lang.Long">
|
||||||
|
@ -274,83 +296,88 @@
|
||||||
<if test="record.stage != null">
|
<if test="record.stage != null">
|
||||||
stage = #{record.stage,jdbcType=VARCHAR},
|
stage = #{record.stage,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.principal != null">
|
<if test="record.principal != null">
|
||||||
principal = #{record.principal,jdbcType=VARCHAR},
|
principal = #{record.principal,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.testCaseMatchRule != null">
|
<if test="record.testCaseMatchRule != null">
|
||||||
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.executorMatchRule != null">
|
<if test="record.executorMatchRule != null">
|
||||||
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.plannedStartTime != null">
|
<if test="record.createTime != null">
|
||||||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.plannedEndTime != null">
|
<if test="record.updateTime != null">
|
||||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.actualStartTime != null">
|
<if test="record.actualEndTime != null">
|
||||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.actualEndTime != null">
|
<if test="record.plannedStartTime != null">
|
||||||
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.createTime != null">
|
<if test="record.plannedEndTime != null">
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.updateTime != null">
|
<if test="record.actualStartTime != null">
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||||
</if>
|
</if>
|
||||||
<if test="record.tags != null">
|
<if test="record.creator != null">
|
||||||
tags = #{record.tags,jdbcType=LONGVARCHAR},
|
creator = #{record.creator,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="record.tags != null">
|
||||||
|
tags = #{record.tags,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
<if test="_parameter != null">
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||||
update test_plan
|
update test_plan
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||||
`name` = #{record.name,jdbcType=VARCHAR},
|
`name` = #{record.name,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
stage = #{record.stage,jdbcType=VARCHAR},
|
stage = #{record.stage,jdbcType=VARCHAR},
|
||||||
principal = #{record.principal,jdbcType=VARCHAR},
|
principal = #{record.principal,jdbcType=VARCHAR},
|
||||||
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
||||||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
||||||
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||||
tags = #{record.tags,jdbcType=LONGVARCHAR}
|
creator = #{record.creator,jdbcType=VARCHAR},
|
||||||
<if test="_parameter != null">
|
tags = #{record.tags,jdbcType=LONGVARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByExample" parameterType="map">
|
<update id="updateByExample" parameterType="map">
|
||||||
update test_plan
|
update test_plan
|
||||||
set id = #{record.id,jdbcType=VARCHAR},
|
set id = #{record.id,jdbcType=VARCHAR},
|
||||||
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
|
||||||
report_id = #{record.reportId,jdbcType=VARCHAR},
|
report_id = #{record.reportId,jdbcType=VARCHAR},
|
||||||
`name` = #{record.name,jdbcType=VARCHAR},
|
`name` = #{record.name,jdbcType=VARCHAR},
|
||||||
description = #{record.description,jdbcType=VARCHAR},
|
description = #{record.description,jdbcType=VARCHAR},
|
||||||
`status` = #{record.status,jdbcType=VARCHAR},
|
`status` = #{record.status,jdbcType=VARCHAR},
|
||||||
stage = #{record.stage,jdbcType=VARCHAR},
|
stage = #{record.stage,jdbcType=VARCHAR},
|
||||||
principal = #{record.principal,jdbcType=VARCHAR},
|
principal = #{record.principal,jdbcType=VARCHAR},
|
||||||
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR},
|
||||||
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||||
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||||
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
||||||
actual_end_time = #{record.actualEndTime,jdbcType=BIGINT},
|
planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT},
|
||||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT},
|
||||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
actual_start_time = #{record.actualStartTime,jdbcType=BIGINT},
|
||||||
<if test="_parameter != null">
|
creator = #{record.creator,jdbcType=VARCHAR}
|
||||||
|
<if test="_parameter != null">
|
||||||
<include refid="Update_By_Example_Where_Clause" />
|
<include refid="Update_By_Example_Where_Clause" />
|
||||||
</if>
|
</if>
|
||||||
</update>
|
</update>
|
||||||
|
@ -373,78 +400,83 @@
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
</if>
|
</if>
|
||||||
<if test="stage != null">
|
<if test="stage != null">
|
||||||
stage = #{stage,jdbcType=VARCHAR},
|
stage = #{stage,jdbcType=VARCHAR},
|
||||||
</if>
|
|
||||||
<if test="principal != null">
|
|
||||||
principal = #{principal,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="testCaseMatchRule != null">
|
|
||||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="executorMatchRule != null">
|
|
||||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
|
||||||
</if>
|
|
||||||
<if test="plannedStartTime != null">
|
|
||||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="plannedEndTime != null">
|
|
||||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="actualStartTime != null">
|
|
||||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="actualEndTime != null">
|
|
||||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="createTime != null">
|
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="updateTime != null">
|
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
|
||||||
</if>
|
|
||||||
<if test="tags != null">
|
|
||||||
tags = #{tags,jdbcType=LONGVARCHAR},
|
|
||||||
</if>
|
</if>
|
||||||
|
<if test="principal != null">
|
||||||
|
principal = #{principal,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="testCaseMatchRule != null">
|
||||||
|
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="executorMatchRule != null">
|
||||||
|
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actualEndTime != null">
|
||||||
|
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="plannedStartTime != null">
|
||||||
|
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="plannedEndTime != null">
|
||||||
|
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="actualStartTime != null">
|
||||||
|
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||||
|
</if>
|
||||||
|
<if test="creator != null">
|
||||||
|
creator = #{creator,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="tags != null">
|
||||||
|
tags = #{tags,jdbcType=LONGVARCHAR},
|
||||||
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlan">
|
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestPlan">
|
||||||
update test_plan
|
update test_plan
|
||||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||||
report_id = #{reportId,jdbcType=VARCHAR},
|
report_id = #{reportId,jdbcType=VARCHAR},
|
||||||
`name` = #{name,jdbcType=VARCHAR},
|
`name` = #{name,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
stage = #{stage,jdbcType=VARCHAR},
|
stage = #{stage,jdbcType=VARCHAR},
|
||||||
principal = #{principal,jdbcType=VARCHAR},
|
principal = #{principal,jdbcType=VARCHAR},
|
||||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT},
|
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||||
tags = #{tags,jdbcType=LONGVARCHAR}
|
creator = #{creator,jdbcType=VARCHAR},
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
tags = #{tags,jdbcType=LONGVARCHAR}
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlan">
|
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestPlan">
|
||||||
update test_plan
|
update test_plan
|
||||||
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
set workspace_id = #{workspaceId,jdbcType=VARCHAR},
|
||||||
report_id = #{reportId,jdbcType=VARCHAR},
|
report_id = #{reportId,jdbcType=VARCHAR},
|
||||||
`name` = #{name,jdbcType=VARCHAR},
|
`name` = #{name,jdbcType=VARCHAR},
|
||||||
description = #{description,jdbcType=VARCHAR},
|
description = #{description,jdbcType=VARCHAR},
|
||||||
`status` = #{status,jdbcType=VARCHAR},
|
`status` = #{status,jdbcType=VARCHAR},
|
||||||
stage = #{stage,jdbcType=VARCHAR},
|
stage = #{stage,jdbcType=VARCHAR},
|
||||||
principal = #{principal,jdbcType=VARCHAR},
|
principal = #{principal,jdbcType=VARCHAR},
|
||||||
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR},
|
||||||
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR},
|
||||||
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
create_time = #{createTime,jdbcType=BIGINT},
|
||||||
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
update_time = #{updateTime,jdbcType=BIGINT},
|
||||||
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
||||||
actual_end_time = #{actualEndTime,jdbcType=BIGINT},
|
planned_start_time = #{plannedStartTime,jdbcType=BIGINT},
|
||||||
create_time = #{createTime,jdbcType=BIGINT},
|
planned_end_time = #{plannedEndTime,jdbcType=BIGINT},
|
||||||
update_time = #{updateTime,jdbcType=BIGINT}
|
actual_start_time = #{actualStartTime,jdbcType=BIGINT},
|
||||||
where id = #{id,jdbcType=VARCHAR}
|
creator = #{creator,jdbcType=VARCHAR}
|
||||||
|
where id = #{id,jdbcType=VARCHAR}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
|
@ -7,15 +7,18 @@ public interface NoticeConstants {
|
||||||
String NAIL_ROBOT = "NAIL_ROBOT";
|
String NAIL_ROBOT = "NAIL_ROBOT";
|
||||||
String WECHAT_ROBOT = "WECHAT_ROBOT";
|
String WECHAT_ROBOT = "WECHAT_ROBOT";
|
||||||
String CREATE = "CREATE";
|
String CREATE = "CREATE";
|
||||||
String UPDATE = "CREATE";
|
String UPDATE = "UPDATE";
|
||||||
String DELETE = "DELETE";
|
String DELETE = "DELETE";
|
||||||
String JENKINS_TASK = "JENKINS_TASK";
|
String JENKINS_TASK = "JENKINS_TASK";
|
||||||
String TEST_PLAN_TASK = "TEST_PLAN_TASK";
|
String TEST_PLAN_TASK = "TEST_PLAN_TASK";
|
||||||
String REVIEW_TASK = "REVIEW_TASK";
|
String REVIEW_TASK = "REVIEW_TASK";
|
||||||
String DEFECT_TASK = "DEFECT_TASK";
|
String DEFECT_TASK = "DEFECT_TASK";
|
||||||
String FOUNDER="FOUNDER";
|
String FOUNDER = "FOUNDER";
|
||||||
String EXECUTOR="EXECUTOR";
|
String EXECUTOR = "EXECUTOR";
|
||||||
String MAINTAINER="MAINTAINER";
|
String MAINTAINER = "MAINTAINER";
|
||||||
|
String COMMENT = "COMMENT";
|
||||||
|
String API = "API";
|
||||||
|
String SCHEDULE = "SCHEDULE";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,33 +11,47 @@ import io.metersphere.notice.domain.UserDetail;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class DingTaskService {
|
public class DingTaskService {
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
public void sendNailRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType){
|
|
||||||
List<String> addresseeIdList=new ArrayList<>();
|
public void sendNailRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType) {
|
||||||
messageDetail.getEvents().forEach(e->{
|
List<String> addresseeIdList = new ArrayList<>();
|
||||||
if(StringUtils.equals(eventType,e)){
|
messageDetail.getEvents().forEach(e -> {
|
||||||
messageDetail.getUserIds().forEach(u->{
|
if (StringUtils.equals(eventType, e)) {
|
||||||
if(StringUtils.equals(NoticeConstants.FOUNDER,u)){
|
messageDetail.getUserIds().forEach(u -> {
|
||||||
addresseeIdList.addAll(userIds);
|
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
}else{
|
|
||||||
addresseeIdList.add(u);
|
addresseeIdList.add(u);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.CREATE, eventType) && StringUtils.equals(NoticeConstants.EXECUTOR, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.UPDATE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.DELETE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.COMMENT, eventType) && StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
sendDingTask(context, addresseeIdList,messageDetail.getWebhook());
|
sendDingTask(context, addresseeIdList, messageDetail.getWebhook());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendDingTask(String context, List<String> userIds,String Webhook) {
|
public void sendDingTask(String context, List<String> userIds, String Webhook) {
|
||||||
DingTalkClient client = new DefaultDingTalkClient(Webhook);
|
DingTalkClient client = new DefaultDingTalkClient(Webhook);
|
||||||
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
OapiRobotSendRequest request = new OapiRobotSendRequest();
|
||||||
request.setMsgtype("text");
|
request.setMsgtype("text");
|
||||||
|
@ -45,13 +59,12 @@ public class DingTaskService {
|
||||||
text.setContent(context);
|
text.setContent(context);
|
||||||
request.setText(text);
|
request.setText(text);
|
||||||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
||||||
List<UserDetail> list=userService.queryTypeByIds(userIds);
|
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||||
List<String> phoneList=new ArrayList<>();
|
List<String> phoneList = new ArrayList<>();
|
||||||
list.forEach(u->{
|
list.forEach(u -> {
|
||||||
phoneList.add(u.getPhone());
|
phoneList.add(u.getPhone());
|
||||||
});
|
});
|
||||||
/* at.setAtMobiles(phoneList);*/
|
at.setAtMobiles(phoneList);
|
||||||
at.setAtMobiles(Arrays.asList("15135125273","13718506428"));
|
|
||||||
request.setAt(at);
|
request.setAt(at);
|
||||||
OapiRobotSendResponse response = null;
|
OapiRobotSendResponse response = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import io.metersphere.commons.constants.APITestStatus;
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.constants.ParamConstants;
|
import io.metersphere.commons.constants.ParamConstants;
|
||||||
import io.metersphere.commons.constants.PerformanceTestStatus;
|
import io.metersphere.commons.constants.PerformanceTestStatus;
|
||||||
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.EncryptUtils;
|
import io.metersphere.commons.utils.EncryptUtils;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.dto.BaseSystemConfigDTO;
|
import io.metersphere.dto.BaseSystemConfigDTO;
|
||||||
|
@ -17,6 +18,8 @@ import io.metersphere.notice.domain.NoticeDetail;
|
||||||
import io.metersphere.notice.domain.UserDetail;
|
import io.metersphere.notice.domain.UserDetail;
|
||||||
import io.metersphere.service.SystemParameterService;
|
import io.metersphere.service.SystemParameterService;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
|
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||||
|
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
||||||
import io.metersphere.track.request.testreview.SaveCommentRequest;
|
import io.metersphere.track.request.testreview.SaveCommentRequest;
|
||||||
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
||||||
import org.apache.commons.collections4.MapUtils;
|
import org.apache.commons.collections4.MapUtils;
|
||||||
|
@ -27,6 +30,7 @@ import org.springframework.mail.MailException;
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
@ -36,9 +40,8 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class MailService {
|
public class MailService {
|
||||||
@Resource
|
|
||||||
private ApiAndPerformanceHelper apiAndPerformanceHelper;
|
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -86,6 +89,27 @@ public class MailService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//jenkins
|
||||||
|
public void sendApiJenkinsNotification(String context, MessageDetail messageDetail) throws MessagingException {
|
||||||
|
JavaMailSenderImpl javaMailSender = getMailSender();
|
||||||
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
|
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||||
|
helper.setFrom(javaMailSender.getUsername());
|
||||||
|
helper.setSubject("MeterSphere平台" + Translator.get("task_notification"));
|
||||||
|
helper.setText(context);
|
||||||
|
List<UserDetail> list = userService.queryTypeByIds(messageDetail.getUserIds());
|
||||||
|
List<String> EmailList = new ArrayList<>();
|
||||||
|
list.forEach(u -> {
|
||||||
|
EmailList.add(u.getEmail());
|
||||||
|
});
|
||||||
|
helper.setTo(EmailList.toArray(new String[0]));
|
||||||
|
try {
|
||||||
|
javaMailSender.send(mimeMessage);
|
||||||
|
} catch (MailException e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void sendHtmlTimeTasks(List<NoticeDetail> noticeList, String status, Map<String, String> context, String template) throws MessagingException {
|
private void sendHtmlTimeTasks(List<NoticeDetail> noticeList, String status, Map<String, String> context, String template) throws MessagingException {
|
||||||
JavaMailSenderImpl javaMailSender = getMailSender();
|
JavaMailSenderImpl javaMailSender = getMailSender();
|
||||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
|
@ -98,15 +122,25 @@ public class MailService {
|
||||||
javaMailSender.send(mimeMessage);
|
javaMailSender.send(mimeMessage);
|
||||||
} catch (MailException e) {
|
} catch (MailException e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
LogUtil.error("Failed to send mail");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//测试评审
|
||||||
public void sendEndNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) {
|
public void sendEndNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) {
|
||||||
Map<String, String> context = getReviewContext(reviewRequest);
|
Map<String, String> context = getReviewContext(reviewRequest);
|
||||||
try {
|
try {
|
||||||
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/end.html"), StandardCharsets.UTF_8);
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/end.html"), StandardCharsets.UTF_8);
|
||||||
sendReviewNotice(addresseeIdList(messageDetail,userIds,eventType), context, endTemplate);
|
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendDeleteNotice(MessageDetail messageDetail, List<String> userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) {
|
||||||
|
Map<String, String> context = getReviewContext(reviewRequest);
|
||||||
|
try {
|
||||||
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/deleteReview.html"), StandardCharsets.UTF_8);
|
||||||
|
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +156,7 @@ public class MailService {
|
||||||
context.put("id", testCaseWithBLOBs.getId());
|
context.put("id", testCaseWithBLOBs.getId());
|
||||||
try {
|
try {
|
||||||
String commentTemplate = IOUtils.toString(this.getClass().getResource("/mail/comment.html"), StandardCharsets.UTF_8);
|
String commentTemplate = IOUtils.toString(this.getClass().getResource("/mail/comment.html"), StandardCharsets.UTF_8);
|
||||||
sendReviewNotice(userIds, context, commentTemplate);
|
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, commentTemplate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
@ -132,7 +166,54 @@ public class MailService {
|
||||||
Map<String, String> context = getReviewContext(reviewRequest);
|
Map<String, String> context = getReviewContext(reviewRequest);
|
||||||
try {
|
try {
|
||||||
String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/reviewer.html"), StandardCharsets.UTF_8);
|
String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/reviewer.html"), StandardCharsets.UTF_8);
|
||||||
sendReviewNotice(addresseeIdList(messageDetail,userIds,eventType), context, reviewerTemplate);
|
sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, reviewerTemplate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//测试计划
|
||||||
|
public void sendTestPlanStartNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||||
|
Map<String, String> context = getTestPlanContext(testPlan);
|
||||||
|
context.put("creator", userIds.toString());
|
||||||
|
try {
|
||||||
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/testPlanStart.html"), StandardCharsets.UTF_8);
|
||||||
|
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendTestPlanEndNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||||
|
Map<String, String> context = getTestPlanContext(testPlan);
|
||||||
|
context.put("creator", userIds.toString());
|
||||||
|
try {
|
||||||
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/testPlanEnd.html"), StandardCharsets.UTF_8);
|
||||||
|
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List<String> userIds, AddTestPlanRequest testPlan, String eventType) {
|
||||||
|
Map<String, String> context = getTestPlanContext(testPlan);
|
||||||
|
context.put("creator", userIds.toString());
|
||||||
|
try {
|
||||||
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/testPlanDelete.html"), StandardCharsets.UTF_8);
|
||||||
|
sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//缺陷任务
|
||||||
|
public void sendIssuesNotice(MessageDetail messageDetail, List<String> userIds, IssuesRequest issuesRequest, String eventType, SessionUser user) {
|
||||||
|
Map<String, String> context = new HashMap<>();
|
||||||
|
context.put("issuesName", issuesRequest.getTitle());
|
||||||
|
context.put("creator", user.getName());
|
||||||
|
try {
|
||||||
|
String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/issuesCreate.html"), StandardCharsets.UTF_8);
|
||||||
|
sendIssuesNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
@ -164,26 +245,87 @@ public class MailService {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Map<String, String> getTestPlanContext(AddTestPlanRequest testPlan) {
|
||||||
|
Long startTime = testPlan.getPlannedStartTime();
|
||||||
|
Long endTime = testPlan.getPlannedEndTime();
|
||||||
|
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<String, String> context = new HashMap<>();
|
||||||
|
BaseSystemConfigDTO baseSystemConfigDTO = systemParameterService.getBaseInfo();
|
||||||
|
context.put("url", baseSystemConfigDTO.getUrl());
|
||||||
|
context.put("testPlanName", testPlan.getName());
|
||||||
|
context.put("start", start);
|
||||||
|
context.put("end", end);
|
||||||
|
context.put("id", testPlan.getId());
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
private void sendReviewNotice(List<String> userIds, Map<String, String> context, String Template) throws MessagingException {
|
private void sendReviewNotice(List<String> userIds, Map<String, String> context, String Template) throws MessagingException {
|
||||||
JavaMailSenderImpl javaMailSender = getMailSender();
|
JavaMailSenderImpl javaMailSender = getMailSender();
|
||||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||||
helper.setFrom(javaMailSender.getUsername());
|
helper.setFrom(javaMailSender.getUsername());
|
||||||
helper.setSubject(Translator.get("test_review_task_notice"));
|
helper.setSubject("MeterSphere平台" + Translator.get("test_review_task_notice"));
|
||||||
String[] users;
|
String[] users;
|
||||||
List<String> emails = new ArrayList<>();
|
List<String> emails = new ArrayList<>();
|
||||||
try {
|
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||||
List<UserDetail> list=userService.queryTypeByIds(userIds);
|
list.forEach(u -> {
|
||||||
list.forEach(u->{
|
emails.add(u.getEmail());
|
||||||
emails.add(u.getEmail());
|
});
|
||||||
});
|
users = emails.toArray(new String[0]);
|
||||||
} catch (Exception e) {
|
helper.setText(getContent(Template, context), true);
|
||||||
LogUtil.error("Recipient information is empty");
|
helper.setTo(users);
|
||||||
|
if (users.length > 0) {
|
||||||
|
javaMailSender.send(mimeMessage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendTestPlanNotice(List<String> userIds, Map<String, String> context, String Template) throws MessagingException {
|
||||||
|
JavaMailSenderImpl javaMailSender = getMailSender();
|
||||||
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
|
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||||
|
helper.setFrom(javaMailSender.getUsername());
|
||||||
|
helper.setSubject("MeterSphere平台" + Translator.get("test_plan_notification"));
|
||||||
|
String[] users;
|
||||||
|
List<String> emails = new ArrayList<>();
|
||||||
|
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||||
|
list.forEach(u -> {
|
||||||
|
emails.add(u.getEmail());
|
||||||
|
});
|
||||||
users = emails.toArray(new String[0]);
|
users = emails.toArray(new String[0]);
|
||||||
helper.setText(getContent(Template, context), true);
|
helper.setText(getContent(Template, context), true);
|
||||||
helper.setTo(users);
|
helper.setTo(users);
|
||||||
javaMailSender.send(mimeMessage);
|
javaMailSender.send(mimeMessage);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendIssuesNotice(List<String> userIds, Map<String, String> context, String Template) throws MessagingException {
|
||||||
|
JavaMailSenderImpl javaMailSender = getMailSender();
|
||||||
|
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||||
|
MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
|
||||||
|
helper.setFrom(javaMailSender.getUsername());
|
||||||
|
helper.setSubject("MeterSphere平台" + Translator.get("task_defect_notification"));
|
||||||
|
String[] users;
|
||||||
|
List<String> emails = new ArrayList<>();
|
||||||
|
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||||
|
list.forEach(u -> {
|
||||||
|
emails.add(u.getEmail());
|
||||||
|
});
|
||||||
|
users = emails.toArray(new String[0]);
|
||||||
|
helper.setText(getContent(Template, context), true);
|
||||||
|
helper.setTo(users);
|
||||||
|
javaMailSender.send(mimeMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JavaMailSenderImpl getMailSender() {
|
private JavaMailSenderImpl getMailSender() {
|
||||||
|
@ -266,15 +408,27 @@ public class MailService {
|
||||||
messageDetail.getEvents().forEach(e -> {
|
messageDetail.getEvents().forEach(e -> {
|
||||||
if (StringUtils.equals(eventType, e)) {
|
if (StringUtils.equals(eventType, e)) {
|
||||||
messageDetail.getUserIds().forEach(u -> {
|
messageDetail.getUserIds().forEach(u -> {
|
||||||
if (StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
addresseeIdList.addAll(userIds);
|
|
||||||
} else {
|
|
||||||
addresseeIdList.add(u);
|
addresseeIdList.add(u);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.CREATE, eventType) && StringUtils.equals(NoticeConstants.EXECUTOR, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.UPDATE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.DELETE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.COMMENT, eventType) && StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return addresseeIdList;
|
return addresseeIdList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package io.metersphere.notice.service;
|
package io.metersphere.notice.service;
|
||||||
|
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.MessageTask;
|
||||||
|
import io.metersphere.base.domain.MessageTaskExample;
|
||||||
|
import io.metersphere.base.domain.Notice;
|
||||||
|
import io.metersphere.base.domain.NoticeExample;
|
||||||
import io.metersphere.base.mapper.MessageTaskMapper;
|
import io.metersphere.base.mapper.MessageTaskMapper;
|
||||||
import io.metersphere.base.mapper.NoticeMapper;
|
import io.metersphere.base.mapper.NoticeMapper;
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
|
@ -10,8 +13,8 @@ import io.metersphere.notice.domain.MessageDetail;
|
||||||
import io.metersphere.notice.domain.MessageSettingDetail;
|
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||||
import io.metersphere.notice.domain.NoticeDetail;
|
import io.metersphere.notice.domain.NoticeDetail;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -21,6 +24,7 @@ import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_FAILED;
|
||||||
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFUL;
|
import static io.metersphere.commons.constants.NoticeConstants.EXECUTE_SUCCESSFUL;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class NoticeService {
|
public class NoticeService {
|
||||||
@Resource
|
@Resource
|
||||||
private NoticeMapper noticeMapper;
|
private NoticeMapper noticeMapper;
|
||||||
|
@ -149,7 +153,7 @@ public class NoticeService {
|
||||||
return user.getTaskType() + "#" + user.getIdentification();
|
return user.getTaskType() + "#" + user.getIdentification();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int delMessage(String identification){
|
public int delMessage(String identification) {
|
||||||
MessageTaskExample example = new MessageTaskExample();
|
MessageTaskExample example = new MessageTaskExample();
|
||||||
example.createCriteria().andIdentificationEqualTo(identification);
|
example.createCriteria().andIdentificationEqualTo(identification);
|
||||||
return messageTaskMapper.deleteByExample(example);
|
return messageTaskMapper.deleteByExample(example);
|
||||||
|
|
|
@ -9,6 +9,7 @@ import io.metersphere.notice.util.WxChatbotClient;
|
||||||
import io.metersphere.service.UserService;
|
import io.metersphere.service.UserService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -16,35 +17,48 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class WxChatTaskService {
|
public class WxChatTaskService {
|
||||||
@Resource
|
@Resource
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
public void sendWechatRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType){
|
|
||||||
List<String> addresseeIdList=new ArrayList<>();
|
public void sendWechatRobot(MessageDetail messageDetail, List<String> userIds, String context, String eventType) {
|
||||||
messageDetail.getEvents().forEach(e->{
|
List<String> addresseeIdList = new ArrayList<>();
|
||||||
if(StringUtils.equals(eventType,e)){
|
messageDetail.getEvents().forEach(e -> {
|
||||||
messageDetail.getUserIds().forEach(u->{
|
if (StringUtils.equals(eventType, e)) {
|
||||||
if(StringUtils.equals(NoticeConstants.FOUNDER,u)){
|
messageDetail.getUserIds().forEach(u -> {
|
||||||
addresseeIdList.addAll(userIds);
|
if (!StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.EXECUTOR, u) && !StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
}else{
|
|
||||||
addresseeIdList.add(u);
|
addresseeIdList.add(u);
|
||||||
}
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.CREATE, eventType) && StringUtils.equals(NoticeConstants.EXECUTOR, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.UPDATE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.DELETE, eventType) && StringUtils.equals(NoticeConstants.FOUNDER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
if (StringUtils.equals(NoticeConstants.COMMENT, eventType) && StringUtils.equals(NoticeConstants.MAINTAINER, u)) {
|
||||||
|
addresseeIdList.addAll(userIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
enterpriseWechatTask(context, addresseeIdList,messageDetail.getWebhook());
|
enterpriseWechatTask(context, addresseeIdList, messageDetail.getWebhook());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public void enterpriseWechatTask(String context, List<String> userIds,String Webhook) {
|
|
||||||
|
public void enterpriseWechatTask(String context, List<String> userIds, String Webhook) {
|
||||||
TextMessage message = new TextMessage(context);
|
TextMessage message = new TextMessage(context);
|
||||||
List<String> mentionedMobileList = new ArrayList<String>();
|
List<String> mentionedMobileList = new ArrayList<String>();
|
||||||
List<UserDetail> list=userService.queryTypeByIds(userIds);
|
List<UserDetail> list = userService.queryTypeByIds(userIds);
|
||||||
List<String> phoneList=new ArrayList<>();
|
List<String> phoneList = new ArrayList<>();
|
||||||
list.forEach(u->{
|
list.forEach(u -> {
|
||||||
phoneList.add(u.getPhone());
|
phoneList.add(u.getPhone());
|
||||||
});
|
});
|
||||||
mentionedMobileList.addAll(phoneList);
|
mentionedMobileList.addAll(phoneList);
|
||||||
mentionedMobileList.add("15135125273");
|
|
||||||
mentionedMobileList.add("18046109770");
|
|
||||||
message.setMentionedMobileList(mentionedMobileList);
|
message.setMentionedMobileList(mentionedMobileList);
|
||||||
try {
|
try {
|
||||||
SendResult result = WxChatbotClient.send(Webhook, message);
|
SendResult result = WxChatbotClient.send(Webhook, message);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
@ -22,6 +23,7 @@ import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class SystemParameterService {
|
public class SystemParameterService {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@ -29,9 +31,10 @@ public class SystemParameterService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExtSystemParameterMapper extSystemParameterMapper;
|
private ExtSystemParameterMapper extSystemParameterMapper;
|
||||||
|
|
||||||
public String searchEmail(){
|
public String searchEmail() {
|
||||||
return extSystemParameterMapper.email();
|
return extSystemParameterMapper.email();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSystemLanguage() {
|
public String getSystemLanguage() {
|
||||||
String result = StringUtils.EMPTY;
|
String result = StringUtils.EMPTY;
|
||||||
SystemParameterExample example = new SystemParameterExample();
|
SystemParameterExample example = new SystemParameterExample();
|
||||||
|
|
|
@ -12,8 +12,8 @@ import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.service.CheckOwnerService;
|
import io.metersphere.service.CheckOwnerService;
|
||||||
import io.metersphere.track.dto.TestCaseReviewDTO;
|
import io.metersphere.track.dto.TestCaseReviewDTO;
|
||||||
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
import io.metersphere.track.dto.TestReviewDTOWithMetric;
|
||||||
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
|
|
||||||
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
||||||
|
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
|
||||||
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
||||||
import io.metersphere.track.request.testreview.TestReviewRelevanceRequest;
|
import io.metersphere.track.request.testreview.TestReviewRelevanceRequest;
|
||||||
import io.metersphere.track.service.TestCaseReviewService;
|
import io.metersphere.track.service.TestCaseReviewService;
|
||||||
|
@ -21,6 +21,7 @@ import io.metersphere.track.service.TestReviewProjectService;
|
||||||
import org.apache.shiro.authz.annotation.Logical;
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,35 @@
|
||||||
package io.metersphere.track.service;
|
package io.metersphere.track.service;
|
||||||
|
|
||||||
import io.metersphere.base.domain.*;
|
import io.metersphere.base.domain.Issues;
|
||||||
|
import io.metersphere.base.domain.Project;
|
||||||
|
import io.metersphere.base.domain.ServiceIntegration;
|
||||||
|
import io.metersphere.base.domain.TestCaseWithBLOBs;
|
||||||
import io.metersphere.base.mapper.IssuesMapper;
|
import io.metersphere.base.mapper.IssuesMapper;
|
||||||
import io.metersphere.commons.constants.IssuesManagePlatform;
|
import io.metersphere.commons.constants.IssuesManagePlatform;
|
||||||
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
import io.metersphere.controller.request.IntegrationRequest;
|
import io.metersphere.controller.request.IntegrationRequest;
|
||||||
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
|
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||||
|
import io.metersphere.notice.service.DingTaskService;
|
||||||
|
import io.metersphere.notice.service.MailService;
|
||||||
|
import io.metersphere.notice.service.NoticeService;
|
||||||
|
import io.metersphere.notice.service.WxChatTaskService;
|
||||||
import io.metersphere.service.IntegrationService;
|
import io.metersphere.service.IntegrationService;
|
||||||
import io.metersphere.service.ProjectService;
|
import io.metersphere.service.ProjectService;
|
||||||
import io.metersphere.track.issue.AbstractIssuePlatform;
|
import io.metersphere.track.issue.AbstractIssuePlatform;
|
||||||
import io.metersphere.track.issue.IssueFactory;
|
import io.metersphere.track.issue.IssueFactory;
|
||||||
import io.metersphere.track.issue.PlatformUser;
|
import io.metersphere.track.issue.PlatformUser;
|
||||||
import io.metersphere.track.request.testcase.IssuesRequest;
|
import io.metersphere.track.request.testcase.IssuesRequest;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -31,7 +43,14 @@ public class IssuesService {
|
||||||
private TestCaseService testCaseService;
|
private TestCaseService testCaseService;
|
||||||
@Resource
|
@Resource
|
||||||
private IssuesMapper issuesMapper;
|
private IssuesMapper issuesMapper;
|
||||||
|
@Resource
|
||||||
|
MailService mailService;
|
||||||
|
@Resource
|
||||||
|
DingTaskService dingTaskService;
|
||||||
|
@Resource
|
||||||
|
WxChatTaskService wxChatTaskService;
|
||||||
|
@Resource
|
||||||
|
NoticeService noticeService;
|
||||||
|
|
||||||
public void testAuth(String platform) {
|
public void testAuth(String platform) {
|
||||||
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
|
AbstractIssuePlatform abstractPlatform = IssueFactory.createPlatform(platform, new IssuesRequest());
|
||||||
|
@ -71,6 +90,28 @@ public class IssuesService {
|
||||||
platformList.forEach(platform -> {
|
platformList.forEach(platform -> {
|
||||||
platform.addIssue(issuesRequest);
|
platform.addIssue(issuesRequest);
|
||||||
});
|
});
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add(orgId);
|
||||||
|
try {
|
||||||
|
String context = getIssuesContext(user, issuesRequest, NoticeConstants.CREATE);
|
||||||
|
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||||
|
List<MessageDetail> taskList = messageSettingDetail.getDefectTask();
|
||||||
|
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.sendIssuesNotice(r, userIds, issuesRequest, NoticeConstants.CREATE, user);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,4 +192,12 @@ public class IssuesService {
|
||||||
public void deleteIssue(String id) {
|
public void deleteIssue(String id) {
|
||||||
issuesMapper.deleteByPrimaryKey(id);
|
issuesMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getIssuesContext(SessionUser user, IssuesRequest issuesRequest, String type) {
|
||||||
|
String context = "";
|
||||||
|
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
||||||
|
context = "缺陷任务通知:" + user.getName() + "发起了一个缺陷" + "'" + issuesRequest.getTitle() + "'" + "请跟进";
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,20 @@ import io.metersphere.base.mapper.UserMapper;
|
||||||
import io.metersphere.commons.constants.NoticeConstants;
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.utils.LogUtil;
|
import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
import io.metersphere.commons.utils.SessionUtils;
|
||||||
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
|
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||||
import io.metersphere.notice.service.DingTaskService;
|
import io.metersphere.notice.service.DingTaskService;
|
||||||
import io.metersphere.notice.service.MailService;
|
import io.metersphere.notice.service.MailService;
|
||||||
|
import io.metersphere.notice.service.NoticeService;
|
||||||
import io.metersphere.notice.service.WxChatTaskService;
|
import io.metersphere.notice.service.WxChatTaskService;
|
||||||
import io.metersphere.track.request.testreview.SaveCommentRequest;
|
import io.metersphere.track.request.testreview.SaveCommentRequest;
|
||||||
import io.metersphere.track.request.testreview.SaveTestCaseReviewRequest;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@ -43,6 +46,9 @@ public class TestCaseCommentService {
|
||||||
DingTaskService dingTaskService;
|
DingTaskService dingTaskService;
|
||||||
@Resource
|
@Resource
|
||||||
WxChatTaskService wxChatTaskService;
|
WxChatTaskService wxChatTaskService;
|
||||||
|
@Resource
|
||||||
|
NoticeService noticeService;
|
||||||
|
|
||||||
|
|
||||||
public void saveComment(SaveCommentRequest request) {
|
public void saveComment(SaveCommentRequest request) {
|
||||||
TestCaseComment testCaseComment = new TestCaseComment();
|
TestCaseComment testCaseComment = new TestCaseComment();
|
||||||
|
@ -55,18 +61,25 @@ 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());//用例维护人
|
||||||
String context = getReviewContext(request, testCaseWithBLOBs);
|
|
||||||
try {
|
try {
|
||||||
/* if (StringUtils.equals(NoticeConstants.NAIL_ROBOT, "NAIL_ROBOT")) {
|
String context = getReviewContext(testCaseComment, testCaseWithBLOBs);
|
||||||
dingTaskService.sendDingTask(context, userIds);
|
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||||
} else if (StringUtils.equals(NoticeConstants.WECHAT_ROBOT, "WECHAT_ROBOT")) {
|
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||||
wxChatTaskService.enterpriseWechatTask();
|
taskList.forEach(r -> {
|
||||||
} else {
|
switch (r.getType()) {
|
||||||
mailService.sendCommentNotice(userIds, request, testCaseWithBLOBs);
|
case NoticeConstants.NAIL_ROBOT:
|
||||||
}*/
|
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.COMMENT);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
|
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.COMMENT);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.EMAIL:
|
||||||
|
mailService.sendCommentNotice(r, userIds, request, testCaseWithBLOBs, NoticeConstants.COMMENT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
@ -93,9 +106,16 @@ public class TestCaseCommentService {
|
||||||
testCaseCommentMapper.deleteByExample(testCaseCommentExample);
|
testCaseCommentMapper.deleteByExample(testCaseCommentExample);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getReviewContext(SaveCommentRequest request, TestCaseWithBLOBs testCaseWithBLOBs) {
|
private String getReviewContext(TestCaseComment testCaseComment, TestCaseWithBLOBs testCaseWithBLOBs) {
|
||||||
|
Long startTime = testCaseComment.getCreateTime();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String start = null;
|
||||||
|
String sTime = String.valueOf(startTime);
|
||||||
|
if (!sTime.equals("null")) {
|
||||||
|
start = sdf.format(new Date(Long.parseLong(sTime)));
|
||||||
|
}
|
||||||
String context = "";
|
String context = "";
|
||||||
context = testCaseWithBLOBs.getMaintainer() + "发起的" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + request.getDescription();
|
context = "测试评审任务通知:" + testCaseComment.getAuthor() + "在" + start + "为" + "'" + testCaseWithBLOBs.getName() + "'" + "添加评论:" + testCaseComment.getDescription();
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ 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.testcase.QueryTestCaseRequest;
|
|
||||||
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
|
||||||
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
|
import io.metersphere.track.request.testreview.QueryTestReviewRequest;
|
||||||
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
|
import io.metersphere.track.request.testreview.ReviewRelevanceRequest;
|
||||||
|
@ -86,10 +85,9 @@ public class TestCaseReviewService {
|
||||||
|
|
||||||
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
|
public void saveTestCaseReview(SaveTestCaseReviewRequest reviewRequest) {
|
||||||
checkCaseReviewExist(reviewRequest);
|
checkCaseReviewExist(reviewRequest);
|
||||||
|
|
||||||
String reviewId = UUID.randomUUID().toString();
|
String reviewId = UUID.randomUUID().toString();
|
||||||
List<String> projectIds = reviewRequest.getProjectIds();
|
List<String> projectIds = reviewRequest.getProjectIds();
|
||||||
List<String> userIds = reviewRequest.getUserIds();
|
List<String> userIds = reviewRequest.getUserIds();//执行人
|
||||||
projectIds.forEach(projectId -> {
|
projectIds.forEach(projectId -> {
|
||||||
TestCaseReviewProject testCaseReviewProject = new TestCaseReviewProject();
|
TestCaseReviewProject testCaseReviewProject = new TestCaseReviewProject();
|
||||||
testCaseReviewProject.setProjectId(projectId);
|
testCaseReviewProject.setProjectId(projectId);
|
||||||
|
@ -107,23 +105,23 @@ public class TestCaseReviewService {
|
||||||
reviewRequest.setId(reviewId);
|
reviewRequest.setId(reviewId);
|
||||||
reviewRequest.setCreateTime(System.currentTimeMillis());
|
reviewRequest.setCreateTime(System.currentTimeMillis());
|
||||||
reviewRequest.setUpdateTime(System.currentTimeMillis());
|
reviewRequest.setUpdateTime(System.currentTimeMillis());
|
||||||
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);
|
||||||
try {
|
try {
|
||||||
String context = getReviewContext(reviewRequest, NoticeConstants.CREATE);
|
String context = getReviewContext(reviewRequest, NoticeConstants.CREATE);
|
||||||
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.CREATE);
|
||||||
break;
|
break;
|
||||||
case NoticeConstants.WECHAT_ROBOT:
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
wxChatTaskService.sendWechatRobot(r,userIds,context,NoticeConstants.CREATE);
|
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.CREATE);
|
||||||
break;
|
break;
|
||||||
case NoticeConstants.EMAIL:
|
case NoticeConstants.EMAIL:
|
||||||
mailService.sendReviewerNotice(r,userIds, reviewRequest,NoticeConstants.CREATE);
|
mailService.sendReviewerNotice(r, userIds, reviewRequest, NoticeConstants.CREATE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -131,7 +129,7 @@ public class TestCaseReviewService {
|
||||||
LogUtil.error(e);
|
LogUtil.error(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) {
|
public List<TestCaseReviewDTO> listCaseReview(QueryCaseReviewRequest request) {
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
|
@ -189,17 +187,17 @@ public class TestCaseReviewService {
|
||||||
try {
|
try {
|
||||||
String context = getReviewContext(testCaseReview, NoticeConstants.CREATE);
|
String context = getReviewContext(testCaseReview, NoticeConstants.CREATE);
|
||||||
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,testCaseReview.getUserIds(),context,NoticeConstants.CREATE);
|
dingTaskService.sendNailRobot(r, testCaseReview.getUserIds(), context, NoticeConstants.CREATE);
|
||||||
break;
|
break;
|
||||||
case NoticeConstants.WECHAT_ROBOT:
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
wxChatTaskService.sendWechatRobot(r,testCaseReview.getUserIds(),context,NoticeConstants.CREATE);
|
wxChatTaskService.sendWechatRobot(r, testCaseReview.getUserIds(), context, NoticeConstants.CREATE);
|
||||||
break;
|
break;
|
||||||
case NoticeConstants.EMAIL:
|
case NoticeConstants.EMAIL:
|
||||||
mailService.sendReviewerNotice(r,testCaseReview.getUserIds(), testCaseReview,NoticeConstants.CREATE);
|
mailService.sendReviewerNotice(r, testCaseReview.getUserIds(), testCaseReview, NoticeConstants.CREATE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -287,10 +285,36 @@ public class TestCaseReviewService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteCaseReview(String reviewId) {
|
public void deleteCaseReview(String reviewId) {
|
||||||
|
TestCaseReview testCaseReview = getTestReview(reviewId);
|
||||||
deleteCaseReviewProject(reviewId);
|
deleteCaseReviewProject(reviewId);
|
||||||
deleteCaseReviewUsers(reviewId);
|
deleteCaseReviewUsers(reviewId);
|
||||||
deleteCaseReviewTestCase(reviewId);
|
deleteCaseReviewTestCase(reviewId);
|
||||||
testCaseReviewMapper.deleteByPrimaryKey(reviewId);
|
testCaseReviewMapper.deleteByPrimaryKey(reviewId);
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add(SessionUtils.getUser().getId());
|
||||||
|
SaveTestCaseReviewRequest testCaseReviewRequest = new SaveTestCaseReviewRequest();
|
||||||
|
try {
|
||||||
|
BeanUtils.copyProperties(testCaseReviewRequest, testCaseReview);
|
||||||
|
String context = getReviewContext(testCaseReviewRequest, NoticeConstants.DELETE);
|
||||||
|
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.DELETE);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
|
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.DELETE);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.EMAIL:
|
||||||
|
mailService.sendDeleteNotice(r, userIds, testCaseReviewRequest, NoticeConstants.DELETE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteCaseReviewProject(String reviewId) {
|
private void deleteCaseReviewProject(String reviewId) {
|
||||||
|
@ -405,31 +429,34 @@ public class TestCaseReviewService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
testCaseReview.setStatus(TestCaseReviewStatus.Completed.name());
|
testCaseReview.setStatus(TestCaseReviewStatus.Completed.name());
|
||||||
|
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
||||||
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());
|
||||||
testCaseReviewMapper.updateByPrimaryKeySelective(testCaseReview);
|
if (StringUtils.equals(TestCaseReviewStatus.Completed.name(), _testCaseReview.getStatus())) {
|
||||||
try {
|
|
||||||
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
|
try {
|
||||||
String context = getReviewContext(testCaseReviewRequest, NoticeConstants.UPDATE);
|
BeanUtils.copyProperties(testCaseReviewRequest, _testCaseReview);
|
||||||
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
String context = getReviewContext(testCaseReviewRequest, NoticeConstants.UPDATE);
|
||||||
List<MessageDetail> taskList=messageSettingDetail.getReviewTask();
|
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||||
taskList.forEach(r->{
|
List<MessageDetail> taskList = messageSettingDetail.getReviewTask();
|
||||||
switch (r.getType()) {
|
taskList.forEach(r -> {
|
||||||
case NoticeConstants.NAIL_ROBOT:
|
switch (r.getType()) {
|
||||||
dingTaskService.sendNailRobot(r,userIds,context,NoticeConstants.CREATE);
|
case NoticeConstants.NAIL_ROBOT:
|
||||||
break;
|
dingTaskService.sendNailRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||||
case NoticeConstants.WECHAT_ROBOT:
|
break;
|
||||||
wxChatTaskService.sendWechatRobot(r,userIds,context,NoticeConstants.CREATE);
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
break;
|
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE);
|
||||||
case NoticeConstants.EMAIL:
|
break;
|
||||||
mailService.sendReviewerNotice(r,userIds, testCaseReviewRequest,NoticeConstants.CREATE);
|
case NoticeConstants.EMAIL:
|
||||||
break;
|
mailService.sendReviewerNotice(r, userIds, testCaseReviewRequest, NoticeConstants.UPDATE);
|
||||||
}
|
break;
|
||||||
});
|
}
|
||||||
} catch (Exception e) {
|
});
|
||||||
LogUtil.error(e);
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +545,8 @@ public class TestCaseReviewService {
|
||||||
request.setProjectIds(projectIds);
|
request.setProjectIds(projectIds);
|
||||||
return extTestReviewCaseMapper.list(request);
|
return extTestReviewCaseMapper.list(request);
|
||||||
}
|
}
|
||||||
/*通知内容*/
|
|
||||||
|
/*编辑,新建,完成,删除通知内容*/
|
||||||
private static String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
|
private static String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {
|
||||||
Long startTime = reviewRequest.getCreateTime();
|
Long startTime = reviewRequest.getCreateTime();
|
||||||
Long endTime = reviewRequest.getEndTime();
|
Long endTime = reviewRequest.getEndTime();
|
||||||
|
@ -535,12 +563,15 @@ public class TestCaseReviewService {
|
||||||
}
|
}
|
||||||
String context = "";
|
String context = "";
|
||||||
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
||||||
context = reviewRequest.getCreator() + "发起的任务通知" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
|
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
|
||||||
} else if (StringUtils.equals(NoticeConstants.UPDATE, type)) {
|
} else if (StringUtils.equals(NoticeConstants.UPDATE, type)) {
|
||||||
context = reviewRequest.getCreator() + "发起的任务通知" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
|
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
|
||||||
|
} else if (StringUtils.equals(NoticeConstants.DELETE, type)) {
|
||||||
|
context = "测试评审任务通知:" + reviewRequest.getCreator() + "发起的" + "'" + reviewRequest.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,19 @@ import io.metersphere.base.mapper.ext.ExtProjectMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestPlanTestCaseMapper;
|
||||||
|
import io.metersphere.commons.constants.NoticeConstants;
|
||||||
import io.metersphere.commons.constants.TestPlanStatus;
|
import io.metersphere.commons.constants.TestPlanStatus;
|
||||||
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
|
||||||
import io.metersphere.commons.exception.MSException;
|
import io.metersphere.commons.exception.MSException;
|
||||||
import io.metersphere.commons.user.SessionUser;
|
import io.metersphere.commons.user.SessionUser;
|
||||||
import io.metersphere.commons.utils.CommonBeanFactory;
|
import io.metersphere.commons.utils.*;
|
||||||
import io.metersphere.commons.utils.MathUtils;
|
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
|
||||||
import io.metersphere.commons.utils.SessionUtils;
|
|
||||||
import io.metersphere.i18n.Translator;
|
import io.metersphere.i18n.Translator;
|
||||||
|
import io.metersphere.notice.domain.MessageDetail;
|
||||||
|
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||||
|
import io.metersphere.notice.service.DingTaskService;
|
||||||
|
import io.metersphere.notice.service.MailService;
|
||||||
|
import io.metersphere.notice.service.NoticeService;
|
||||||
|
import io.metersphere.notice.service.WxChatTaskService;
|
||||||
import io.metersphere.track.Factory.ReportComponentFactory;
|
import io.metersphere.track.Factory.ReportComponentFactory;
|
||||||
import io.metersphere.track.domain.ReportComponent;
|
import io.metersphere.track.domain.ReportComponent;
|
||||||
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
import io.metersphere.track.dto.TestCaseReportMetricDTO;
|
||||||
|
@ -25,7 +29,6 @@ import io.metersphere.track.dto.TestPlanCaseDTO;
|
||||||
import io.metersphere.track.dto.TestPlanDTO;
|
import io.metersphere.track.dto.TestPlanDTO;
|
||||||
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
import io.metersphere.track.dto.TestPlanDTOWithMetric;
|
||||||
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
|
import io.metersphere.track.request.testcase.PlanCaseRelevanceRequest;
|
||||||
import io.metersphere.track.request.testcase.QueryTestCaseRequest;
|
|
||||||
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
import io.metersphere.track.request.testcase.QueryTestPlanRequest;
|
||||||
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
import io.metersphere.track.request.testplan.AddTestPlanRequest;
|
||||||
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
|
||||||
|
@ -39,7 +42,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.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -82,6 +85,14 @@ public class TestPlanService {
|
||||||
ProjectMapper projectMapper;
|
ProjectMapper projectMapper;
|
||||||
@Resource
|
@Resource
|
||||||
ExtTestCaseMapper extTestCaseMapper;
|
ExtTestCaseMapper extTestCaseMapper;
|
||||||
|
@Resource
|
||||||
|
NoticeService noticeService;
|
||||||
|
@Resource
|
||||||
|
MailService mailService;
|
||||||
|
@Resource
|
||||||
|
DingTaskService dingTaskService;
|
||||||
|
@Resource
|
||||||
|
WxChatTaskService wxChatTaskService;
|
||||||
|
|
||||||
public void addTestPlan(AddTestPlanRequest testPlan) {
|
public void addTestPlan(AddTestPlanRequest testPlan) {
|
||||||
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
if (getTestPlanByName(testPlan.getName()).size() > 0) {
|
||||||
|
@ -102,7 +113,31 @@ public class TestPlanService {
|
||||||
testPlan.setStatus(TestPlanStatus.Prepare.name());
|
testPlan.setStatus(TestPlanStatus.Prepare.name());
|
||||||
testPlan.setCreateTime(System.currentTimeMillis());
|
testPlan.setCreateTime(System.currentTimeMillis());
|
||||||
testPlan.setUpdateTime(System.currentTimeMillis());
|
testPlan.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testPlan.setCreator(SessionUtils.getUser().getId());
|
||||||
testPlanMapper.insert(testPlan);
|
testPlanMapper.insert(testPlan);
|
||||||
|
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add(testPlan.getPrincipal());
|
||||||
|
try {
|
||||||
|
String context = getTestPlanContext(testPlan, NoticeConstants.CREATE);
|
||||||
|
MessageSettingDetail messageSettingDetail = noticeService.searchMessage();
|
||||||
|
List<MessageDetail> taskList = messageSettingDetail.getTestCasePlanTask();
|
||||||
|
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.sendTestPlanStartNotice(r, userIds, testPlan, NoticeConstants.CREATE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestPlan> getTestPlanByName(String name) {
|
public List<TestPlan> getTestPlanByName(String name) {
|
||||||
|
@ -128,6 +163,30 @@ public class TestPlanService {
|
||||||
//已完成,写入实际完成时间
|
//已完成,写入实际完成时间
|
||||||
testPlan.setActualEndTime(System.currentTimeMillis());
|
testPlan.setActualEndTime(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add(testPlan.getPrincipal());
|
||||||
|
AddTestPlanRequest testPlans = new AddTestPlanRequest();
|
||||||
|
/* try {
|
||||||
|
BeanUtils.copyBean(testPlans, testPlan);
|
||||||
|
String context = getTestPlanContext(testPlans, 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.sendTestPlanStartNotice(r, userIds, testPlans, NoticeConstants.CREATE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}*/
|
||||||
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
return testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,9 +242,35 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteTestPlan(String planId) {
|
public int deleteTestPlan(String planId) {
|
||||||
|
TestPlan testPlan = getTestPlan(planId);
|
||||||
deleteTestCaseByPlanId(planId);
|
deleteTestCaseByPlanId(planId);
|
||||||
testPlanProjectService.deleteTestPlanProjectByPlanId(planId);
|
testPlanProjectService.deleteTestPlanProjectByPlanId(planId);
|
||||||
return testPlanMapper.deleteByPrimaryKey(planId);
|
int num = testPlanMapper.deleteByPrimaryKey(planId);
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
AddTestPlanRequest testPlans = new AddTestPlanRequest();
|
||||||
|
userIds.add(testPlan.getCreator());
|
||||||
|
try {
|
||||||
|
BeanUtils.copyBean(testPlans, testPlan);
|
||||||
|
String context = getTestPlanContext(testPlans, NoticeConstants.DELETE);
|
||||||
|
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.DELETE);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.WECHAT_ROBOT:
|
||||||
|
wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.DELETE);
|
||||||
|
break;
|
||||||
|
case NoticeConstants.EMAIL:
|
||||||
|
mailService.sendTestPlanDeleteNotice(r, userIds, testPlans, NoticeConstants.DELETE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteTestCaseByPlanId(String testPlanId) {
|
public void deleteTestCaseByPlanId(String testPlanId) {
|
||||||
|
@ -389,7 +474,6 @@ public class TestPlanService {
|
||||||
List<String> statusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);
|
List<String> statusList = extTestPlanTestCaseMapper.getStatusByPlanId(planId);
|
||||||
TestPlan testPlan = new TestPlan();
|
TestPlan testPlan = new TestPlan();
|
||||||
testPlan.setId(planId);
|
testPlan.setId(planId);
|
||||||
|
|
||||||
for (String status : statusList) {
|
for (String status : statusList) {
|
||||||
if (StringUtils.equals(status, TestPlanTestCaseStatus.Prepare.name())
|
if (StringUtils.equals(status, TestPlanTestCaseStatus.Prepare.name())
|
||||||
|| StringUtils.equals(status, TestPlanTestCaseStatus.Underway.name())) {
|
|| StringUtils.equals(status, TestPlanTestCaseStatus.Underway.name())) {
|
||||||
|
@ -400,6 +484,34 @@ public class TestPlanService {
|
||||||
}
|
}
|
||||||
testPlan.setStatus(TestPlanStatus.Completed.name());
|
testPlan.setStatus(TestPlanStatus.Completed.name());
|
||||||
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
testPlanMapper.updateByPrimaryKeySelective(testPlan);
|
||||||
|
TestPlan testPlans = getTestPlan(planId);
|
||||||
|
List<String> userIds = new ArrayList<>();
|
||||||
|
userIds.add(testPlans.getCreator());
|
||||||
|
AddTestPlanRequest _testPlans = new AddTestPlanRequest();
|
||||||
|
if (StringUtils.equals(TestPlanStatus.Completed.name(), testPlans.getStatus())) {
|
||||||
|
try {
|
||||||
|
BeanUtils.copyBean(_testPlans, testPlans);
|
||||||
|
String context = getTestPlanContext(_testPlans, 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.sendTestPlanEndNotice(r, userIds, _testPlans, NoticeConstants.UPDATE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtil.error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProjectNameByPlanId(String testPlanId) {
|
public String getProjectNameByPlanId(String testPlanId) {
|
||||||
|
@ -420,4 +532,30 @@ public class TestPlanService {
|
||||||
|
|
||||||
return projectName;
|
return projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getTestPlanContext(AddTestPlanRequest testPlan, String type) {
|
||||||
|
Long startTime = testPlan.getPlannedStartTime();
|
||||||
|
Long endTime = testPlan.getPlannedEndTime();
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
String context = "";
|
||||||
|
if (StringUtils.equals(NoticeConstants.CREATE, type)) {
|
||||||
|
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "待开始,计划开始时间是" + start + "计划结束时间为" + end + "请跟进";
|
||||||
|
} else if (StringUtils.equals(NoticeConstants.UPDATE, type)) {
|
||||||
|
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "已完成,计划开始时间是" + start + "计划结束时间为" + end + "已完成";
|
||||||
|
} else if (StringUtils.equals(NoticeConstants.DELETE, type)) {
|
||||||
|
context = "测试计划任务通知:" + testPlan.getCreator() + "创建的" + "'" + testPlan.getName() + "'" + "计划开始时间是" + start + "计划结束时间为" + end + "已删除";
|
||||||
|
}
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
alter table test_plan
|
||||||
|
add creator varchar(255) not null;
|
|
@ -67,6 +67,7 @@
|
||||||
<table tableName="schedule"/>
|
<table tableName="schedule"/>
|
||||||
<table tableName="notice"/>
|
<table tableName="notice"/>
|
||||||
<table tableName="message_task"/>
|
<table tableName="message_task"/>
|
||||||
|
<table tableName="test_plan"/>
|
||||||
|
|
||||||
</context>
|
</context>
|
||||||
</generatorConfiguration>
|
</generatorConfiguration>
|
|
@ -164,4 +164,10 @@ check_owner_test=The current user does not have permission to operate this test
|
||||||
check_owner_case=The current user does not have permission to operate this use case
|
check_owner_case=The current user does not have permission to operate this use case
|
||||||
check_owner_plan=The current user does not have permission to operate this plan
|
check_owner_plan=The current user does not have permission to operate this plan
|
||||||
check_owner_review=The current user does not have permission to operate this review
|
check_owner_review=The current user does not have permission to operate this review
|
||||||
upload_content_is_null=Imported content is empty
|
upload_content_is_null=Imported content is empty
|
||||||
|
test_plan_notification=Test plan notification
|
||||||
|
task_defect_notification=Task defect notification
|
||||||
|
task_notification=Jenkins Task notification
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -164,4 +164,7 @@ check_owner_test=当前用户没有操作此测试的权限
|
||||||
check_owner_case=当前用户没有操作此用例的权限
|
check_owner_case=当前用户没有操作此用例的权限
|
||||||
check_owner_plan=当前用户没有操作此计划的权限
|
check_owner_plan=当前用户没有操作此计划的权限
|
||||||
check_owner_review=当前用户没有操作此评审的权限
|
check_owner_review=当前用户没有操作此评审的权限
|
||||||
upload_content_is_null=导入内容为空
|
upload_content_is_null=导入内容为空
|
||||||
|
test_plan_notification=测试计划通知
|
||||||
|
task_defect_notification=缺陷任务通知
|
||||||
|
task_notification=jenkins任务通知
|
|
@ -165,4 +165,8 @@ check_owner_test=當前用戶沒有操作此測試的權限
|
||||||
check_owner_case=當前用戶沒有操作此用例的權限
|
check_owner_case=當前用戶沒有操作此用例的權限
|
||||||
check_owner_plan=當前用戶沒有操作此計劃的權限
|
check_owner_plan=當前用戶沒有操作此計劃的權限
|
||||||
check_owner_review=當前用戶沒有操作此評審的權限
|
check_owner_review=當前用戶沒有操作此評審的權限
|
||||||
upload_content_is_null=導入內容為空
|
upload_content_is_null=導入內容為空
|
||||||
|
test_plan_notification=測試計畫通知
|
||||||
|
task_defect_notification=缺陷任務通知
|
||||||
|
task_notification=jenkins任務通知
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>MeterSphere</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p style="text-align: left">${creator} 发起的:<br>
|
||||||
|
${reviewName}<br>
|
||||||
|
计划开始时间是:${start}<br>
|
||||||
|
计划结束时间为:${end}<br>
|
||||||
|
已删除<br>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>MeterSphere</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p>${creator}发起了一个缺陷:${issuesName},请跟进</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>MeterSphere</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p style="text-align: left">${creator} 创建的:<br>
|
||||||
|
${testPlanName}<br>
|
||||||
|
计划开始时间是:${start}<br>
|
||||||
|
计划结束时间为:${end}<br>
|
||||||
|
已删除!
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>MeterSphere</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p style="text-align: left">${creator} 创建的:<br>
|
||||||
|
${testPlanName}已完成<br>
|
||||||
|
计划开始时间是:${start}<br>
|
||||||
|
计划结束时间为:${end}<br>
|
||||||
|
已完成!<br>
|
||||||
|
点击下面链接进入测试计划页面</p>
|
||||||
|
<a href="${url}/#/track/plan/view/${id}">${url}/#/track/plan/view</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>MeterSphere</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<p style="text-align: left">${creator} 创建的:<br>
|
||||||
|
${testPlanName}<br>
|
||||||
|
计划开始时间是:${start}<br>
|
||||||
|
计划结束时间为:${end}<br>
|
||||||
|
请跟进!<br>
|
||||||
|
点击下面链接进入测试计划页面</p>
|
||||||
|
<a href="${url}/#/track/plan/view/${id}">${url}/#/track/plan/view</a>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -5,10 +5,10 @@
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<div class="grid-content bg-purple-dark">
|
<div class="grid-content bg-purple-dark">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="10">
|
||||||
<span style="font-weight:bold;">{{ $t('organization.message.jenkins_task_notification') }}</span>
|
<span style="font-weight:bold;">{{ $t('organization.message.jenkins_task_notification') }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14">
|
<el-col :span="10">
|
||||||
<el-button type="text" icon="el-icon-plus" size="mini"
|
<el-button type="text" icon="el-icon-plus" size="mini"
|
||||||
@click="handleAddTaskModel('jenkinsTask')">
|
@click="handleAddTaskModel('jenkinsTask')">
|
||||||
{{ $t('organization.message.create_new_notification') }}
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
|
@ -22,13 +22,15 @@
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
size="mini"
|
size="mini"
|
||||||
:header-cell-style="{background:'#ededed'}"
|
:cell-style="rowClass"
|
||||||
|
:header-cell-style="headClass"
|
||||||
|
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.events" multiple
|
<el-select v-model="scope.row.events" multiple
|
||||||
:placeholder="$t('organization.message.select_events')"
|
:placeholder="$t('organization.message.select_events')"
|
||||||
prop="events">
|
prop="events" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in jenkinsEventOptions"
|
v-for="item in jenkinsEventOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -42,7 +44,7 @@
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.userIds" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
@click.native="userList()" style="width: 100%;">
|
@click.native="userList()" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in jenkinsReceiverOptions"
|
v-for="item in jenkinsReceiverOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -54,7 +56,8 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
|
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet" @change="handleEdit(scope.$index, scope.row)"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in receiveTypeOptions"
|
v-for="item in receiveTypeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -66,7 +69,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
|
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet||scope.row.events === 'EMAIL'"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||||
|
@ -102,10 +105,10 @@
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<div class="grid-content bg-purple-dark">
|
<div class="grid-content bg-purple-dark">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="10">
|
||||||
<span style="font-weight:bold;">{{ $t('organization.message.test_plan_task_notification') }}</span>
|
<span style="font-weight:bold;">{{ $t('organization.message.test_plan_task_notification') }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14">
|
<el-col :span="10">
|
||||||
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('testPlanTask')">
|
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('testPlanTask')">
|
||||||
{{ $t('organization.message.create_new_notification') }}
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -117,12 +120,13 @@
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
size="mini"
|
size="mini"
|
||||||
:header-cell-style="{background:'#EDEDED'}"
|
:cell-style="rowClass"
|
||||||
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||||
prop="events">
|
prop="events" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in otherEventOptions"
|
v-for="item in otherEventOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -136,7 +140,7 @@
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.userIds" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
@click.native="testPlanUserList()" style="width: 100%;">
|
@click.native="testPlanUserList()" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in testPlanReceiverOptions"
|
v-for="item in testPlanReceiverOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -148,7 +152,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
|
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in receiveTypeOptions"
|
v-for="item in receiveTypeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -160,7 +164,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
|
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||||
|
@ -194,10 +198,10 @@
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<div class="grid-content bg-purple-dark">
|
<div class="grid-content bg-purple-dark">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="10">
|
||||||
<span style="font-weight:bold;">{{ $t('organization.message.test_review_task_notice') }}</span>
|
<span style="font-weight:bold;">{{ $t('organization.message.test_review_task_notice') }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14">
|
<el-col :span="10">
|
||||||
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('reviewTask')">
|
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('reviewTask')">
|
||||||
{{ $t('organization.message.create_new_notification') }}
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -209,14 +213,15 @@
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
size="mini"
|
size="mini"
|
||||||
:header-cell-style="{background:'#EDEDED'}"
|
:cell-style="rowClass"
|
||||||
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||||
prop="event">
|
prop="event" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in otherEventOptions"
|
v-for="item in reviewTaskEventOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
|
@ -228,7 +233,7 @@
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.userIds" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
@click.native="reviewUerList()" style="width: 100%;">
|
@click.native="reviewUerList()" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in reviewReceiverOptions"
|
v-for="item in reviewReceiverOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -240,7 +245,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
|
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in receiveTypeOptions"
|
v-for="item in receiveTypeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -252,7 +257,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
|
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||||
|
@ -286,10 +291,10 @@
|
||||||
<el-col :span="20">
|
<el-col :span="20">
|
||||||
<div class="grid-content bg-purple-dark">
|
<div class="grid-content bg-purple-dark">
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="6">
|
<el-col :span="10">
|
||||||
<span style="font-weight:bold;">{{ $t('organization.message.defect_task_notification') }}</span>
|
<span style="font-weight:bold;">{{ $t('organization.message.defect_task_notification') }}</span>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="14">
|
<el-col :span="10">
|
||||||
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('defectTask')">
|
<el-button type="text" icon="el-icon-plus" size="mini" @click="handleAddTaskModel('defectTask')">
|
||||||
{{ $t('organization.message.create_new_notification') }}
|
{{ $t('organization.message.create_new_notification') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
@ -301,14 +306,15 @@
|
||||||
class="tb-edit"
|
class="tb-edit"
|
||||||
border
|
border
|
||||||
size="mini"
|
size="mini"
|
||||||
:header-cell-style="{background:'#EDEDED'}"
|
:cell-style="rowClass"
|
||||||
|
:header-cell-style="headClass"
|
||||||
>
|
>
|
||||||
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
<el-table-column :label="$t('schedule.event')" min-width="20%" prop="events">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
<el-select v-model="scope.row.events" multiple :placeholder="$t('organization.message.select_events')"
|
||||||
prop="event">
|
prop="event" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in otherEventOptions"
|
v-for="item in defectEventOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:label="item.label"
|
:label="item.label"
|
||||||
:value="item.value">
|
:value="item.value">
|
||||||
|
@ -320,7 +326,7 @@
|
||||||
<template v-slot:default="{row}">
|
<template v-slot:default="{row}">
|
||||||
<el-select v-model="row.userIds" filterable multiple
|
<el-select v-model="row.userIds" filterable multiple
|
||||||
:placeholder="$t('commons.please_select')"
|
:placeholder="$t('commons.please_select')"
|
||||||
@click.native="defectUserList()" style="width: 100%;">
|
@click.native="defectUserList()" style="width: 100%;" :disabled="!row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in defectReceiverOptions"
|
v-for="item in defectReceiverOptions"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
|
@ -332,7 +338,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
<el-table-column :label="$t('schedule.receiving_mode')" min-width="20%" prop="type">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')">
|
<el-select v-model="scope.row.type" :placeholder="$t('organization.message.select_receiving_method')" :disabled="!scope.row.isSet">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in receiveTypeOptions"
|
v-for="item in receiveTypeOptions"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
|
@ -344,7 +350,7 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
<el-table-column label="webhook" min-width="20%" prop="webhook">
|
||||||
<template v-slot:default="scope">
|
<template v-slot:default="scope">
|
||||||
<el-input v-model="scope.row.webhook" placeholder="webhook地址"></el-input>
|
<el-input v-model="scope.row.webhook" placeholder="webhook地址" :disabled="!scope.row.isSet"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
<el-table-column :label="$t('commons.operating')" min-width="20%" prop="result">
|
||||||
|
@ -367,7 +373,7 @@
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
v-show="!scope.row.isSet"
|
v-show="!scope.row.isSet"
|
||||||
@click.native.prevent="deleteRowTask(scope.$index,scope.row)"
|
@click="deleteRowTask(scope.$index,scope.row)"
|
||||||
></el-button>
|
></el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -437,6 +443,18 @@ export default {
|
||||||
{value: 'UPDATE', label: this.$t('commons.update')},
|
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||||
{value: 'DELETE', label: this.$t('commons.delete')}
|
{value: 'DELETE', label: this.$t('commons.delete')}
|
||||||
],
|
],
|
||||||
|
reviewTaskEventOptions:[
|
||||||
|
{value: 'CREATE', label: this.$t('commons.create')},
|
||||||
|
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||||
|
{value: 'DELETE', label: this.$t('commons.delete')},
|
||||||
|
{value: 'COMMENT', label: this.$t('commons.comment')}
|
||||||
|
],
|
||||||
|
defectEventOptions:[
|
||||||
|
{value: 'CREATE', label: this.$t('commons.create')},
|
||||||
|
/*
|
||||||
|
{value: 'UPDATE', label: this.$t('commons.update')},
|
||||||
|
*/
|
||||||
|
],
|
||||||
//测试计划
|
//测试计划
|
||||||
testPlanReceiverOptions: [],
|
testPlanReceiverOptions: [],
|
||||||
//评审
|
//评审
|
||||||
|
@ -445,10 +463,18 @@ export default {
|
||||||
defectReceiverOptions: [],
|
defectReceiverOptions: [],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
activated(){
|
activated(){
|
||||||
this.initForm()
|
this.initForm()
|
||||||
|
this. userList()
|
||||||
|
this.testPlanUserList()
|
||||||
|
this.defectUserList()
|
||||||
|
this.reviewUerList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleEdit(index, data){
|
||||||
|
|
||||||
|
},
|
||||||
initForm() {
|
initForm() {
|
||||||
this.result = this.$get('/notice/search/message', response => {
|
this.result = this.$get('/notice/search/message', response => {
|
||||||
this.form = response.data
|
this.form = response.data
|
||||||
|
@ -462,18 +488,18 @@ export default {
|
||||||
reviewUerList() {
|
reviewUerList() {
|
||||||
this.result = this.$get('user/list', response => {
|
this.result = this.$get('user/list', response => {
|
||||||
this.reviewReceiverOptions = response.data
|
this.reviewReceiverOptions = response.data
|
||||||
this.reviewReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')},
|
this.reviewReceiverOptions.unshift({id: 'EXECUTOR', name: this.$t('test_track.review.reviewer')},
|
||||||
{id: 'Executor', name: this.$t('test_track.plan_view.executor')},
|
{id: 'FOUNDER', name: this.$t('test_track.review.review_creator')},
|
||||||
{id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')})
|
{id: 'MAINTAINER', name: this.$t('test_track.case.maintainer')})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
defectUserList() {
|
defectUserList() {
|
||||||
this.result = this.$get('user/list', response => {
|
this.result = this.$get('user/list', response => {
|
||||||
this.defectReceiverOptions = response.data
|
this.defectReceiverOptions = response.data
|
||||||
this.defectReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')}, {
|
/* this.defectReceiverOptions.unshift({id: 'FOUNDER', name: this.$t('api_test.creator')}, {
|
||||||
id: 'EXECUTOR',
|
id: 'EXECUTOR',
|
||||||
name: this.$t('test_track.plan_view.executor')
|
name: this.$t('test_track.plan_view.executor')
|
||||||
})
|
})*/
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
testPlanUserList() {
|
testPlanUserList() {
|
||||||
|
@ -513,23 +539,34 @@ export default {
|
||||||
|
|
||||||
handleAddTask(index, data) {
|
handleAddTask(index, data) {
|
||||||
let list = []
|
let list = []
|
||||||
data.isSet = false
|
if(data.events.length>0 && data.userIds.length>0 && data.type){
|
||||||
list.push(data)
|
data.isSet = false
|
||||||
let param = {};
|
list.push(data)
|
||||||
param.messageDetail = list
|
let param = {};
|
||||||
this.result = this.$post("/notice/save/message/task", param, () => {
|
param.messageDetail = list
|
||||||
|
this.result = this.$post("/notice/save/message/task", param, () => {
|
||||||
})
|
this.initForm()
|
||||||
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
removeRowTask(index, data) { //移除
|
removeRowTask(index, data) { //移除
|
||||||
data.splice(index, 1)
|
data.splice(index, 1)
|
||||||
},
|
},
|
||||||
deleteRowTask(index, data) { //删除
|
deleteRowTask(index, data) { //删除
|
||||||
this.result = this.$get("/notice/delete/message/" + data.identification, response => {
|
this.result = this.$get("/notice/delete/message/" + data.identification, response => {
|
||||||
|
this.$success(this.$t('commons.delete_success'));
|
||||||
this.initForm()
|
this.initForm()
|
||||||
})
|
})
|
||||||
/*data.splice(index, 1)*/
|
/*data.splice(index, 1)*/
|
||||||
},
|
},
|
||||||
|
rowClass() {
|
||||||
|
return "text-align:center"
|
||||||
|
},
|
||||||
|
headClass() {
|
||||||
|
return "text-align:center;background:'#ededed'"
|
||||||
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -48,11 +48,11 @@ export default {
|
||||||
component: () => import('@/business/components/settings/organization/ServiceIntegration'),
|
component: () => import('@/business/components/settings/organization/ServiceIntegration'),
|
||||||
meta: {organization: true, title: 'organization.service_integration'}
|
meta: {organization: true, title: 'organization.service_integration'}
|
||||||
},
|
},
|
||||||
/*{
|
{
|
||||||
path: 'messagesettings',
|
path: 'messagesettings',
|
||||||
component: () => import('@/business/components/settings/organization/MessageSettings'),
|
component: () => import('@/business/components/settings/organization/MessageSettings'),
|
||||||
meta: {organization: true, title: 'organization.message_settings'}
|
meta: {organization: true, title: 'organization.message_settings'}
|
||||||
},*/
|
},
|
||||||
{
|
{
|
||||||
path: 'member',
|
path: 'member',
|
||||||
component: () => import('@/business/components/settings/workspace/WorkspaceMember'),
|
component: () => import('@/business/components/settings/workspace/WorkspaceMember'),
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
comment:'comment',
|
||||||
examples: 'examples',
|
examples: 'examples',
|
||||||
help_documentation: 'Help documentation',
|
help_documentation: 'Help documentation',
|
||||||
delete_cancelled: 'Delete cancelled',
|
delete_cancelled: 'Delete cancelled',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
comment:'评论',
|
||||||
examples: '示例',
|
examples: '示例',
|
||||||
help_documentation: '帮助文档',
|
help_documentation: '帮助文档',
|
||||||
delete_cancelled: '已取消删除',
|
delete_cancelled: '已取消删除',
|
||||||
|
@ -218,7 +219,7 @@ export default {
|
||||||
defect_manage: '缺陷管理平台',
|
defect_manage: '缺陷管理平台',
|
||||||
message_settings:'消息设置',
|
message_settings:'消息设置',
|
||||||
message:{
|
message:{
|
||||||
jenkins_task_notification:'Jenkins任务通知',
|
jenkins_task_notification:'Jenkins接口调用任务通知',
|
||||||
test_plan_task_notification:'测试计划任务通知',
|
test_plan_task_notification:'测试计划任务通知',
|
||||||
test_review_task_notice:'测试评审任务通知',
|
test_review_task_notice:'测试评审任务通知',
|
||||||
create_new_notification:'创建新通知',
|
create_new_notification:'创建新通知',
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export default {
|
export default {
|
||||||
commons: {
|
commons: {
|
||||||
|
comment:'評論',
|
||||||
examples: '示例',
|
examples: '示例',
|
||||||
help_documentation: '幫助文檔',
|
help_documentation: '幫助文檔',
|
||||||
delete_cancelled: '已取消刪除',
|
delete_cancelled: '已取消刪除',
|
||||||
|
|
Loading…
Reference in New Issue