mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
fix:修复消息设置testId为空时异常
This commit is contained in:
parent
a2f1e18aa7
commit
977db2fdb2
@ -13,6 +13,7 @@ import io.metersphere.notice.controller.request.MessageRequest;
|
||||
import io.metersphere.notice.domain.MessageDetail;
|
||||
import io.metersphere.notice.domain.MessageSettingDetail;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -70,7 +71,11 @@ public class NoticeService {
|
||||
|
||||
private void checkUserIdExist(String userId, MessageDetail list,String orgId) {
|
||||
MessageTaskExample example = new MessageTaskExample();
|
||||
example.createCriteria().andUserIdEqualTo(userId).andEventEqualTo(list.getEvent()).andTypeEqualTo(list.getType()).andTaskTypeEqualTo(list.getTaskType()).andWebhookEqualTo(list.getWebhook()).andTestIdEqualTo(list.getTestId()).andOrganizationIdEqualTo(orgId);
|
||||
if (StringUtils.isBlank(list.getTestId())) {
|
||||
example.createCriteria().andUserIdEqualTo(userId).andEventEqualTo(list.getEvent()).andTypeEqualTo(list.getType()).andTaskTypeEqualTo(list.getTaskType()).andWebhookEqualTo(list.getWebhook()).andOrganizationIdEqualTo(orgId);
|
||||
} else {
|
||||
example.createCriteria().andUserIdEqualTo(userId).andEventEqualTo(list.getEvent()).andTypeEqualTo(list.getType()).andTaskTypeEqualTo(list.getTaskType()).andWebhookEqualTo(list.getWebhook()).andTestIdEqualTo(list.getTestId()).andOrganizationIdEqualTo(orgId);
|
||||
}
|
||||
if (messageTaskMapper.countByExample(example) > 0) {
|
||||
MSException.throwException(Translator.get("message_task_already_exists"));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user