fix: 通知人出入参改为统一的recipientIds
This commit is contained in:
parent
7fb61350d6
commit
39e106b7fa
@ -1,13 +1,11 @@
|
|||||||
package com.aizuda.snailjob.server.web.model.request;
|
package com.aizuda.snailjob.server.web.model.request;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Pattern;
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +38,7 @@ public class NotifyConfigRequestVO {
|
|||||||
private Integer notifyStatus;
|
private Integer notifyStatus;
|
||||||
|
|
||||||
@NotEmpty(message = "通知人列表")
|
@NotEmpty(message = "通知人列表")
|
||||||
private Set<Long> notifyRecipientIds;
|
private Set<Long> recipientIds;
|
||||||
|
|
||||||
private Integer notifyThreshold;
|
private Integer notifyThreshold;
|
||||||
|
|
||||||
|
@ -20,11 +20,6 @@ public interface NotifyConfigConverter {
|
|||||||
|
|
||||||
NotifyConfigConverter INSTANCE = Mappers.getMapper(NotifyConfigConverter.class);
|
NotifyConfigConverter INSTANCE = Mappers.getMapper(NotifyConfigConverter.class);
|
||||||
|
|
||||||
@Mappings({
|
|
||||||
@Mapping(target = "recipientIds", expression = "java(NotifyConfigConverter.toNotifyRecipientIdsStr(notifyConfigVO.getNotifyRecipientIds()))")
|
|
||||||
})
|
|
||||||
NotifyConfig toNotifyConfig(NotifyConfigRequestVO notifyConfigVO);
|
|
||||||
|
|
||||||
static String toNotifyRecipientIdsStr(Set<Long> notifyRecipientIds) {
|
static String toNotifyRecipientIdsStr(Set<Long> notifyRecipientIds) {
|
||||||
if (CollectionUtils.isEmpty(notifyRecipientIds)) {
|
if (CollectionUtils.isEmpty(notifyRecipientIds)) {
|
||||||
return null;
|
return null;
|
||||||
@ -32,4 +27,9 @@ public interface NotifyConfigConverter {
|
|||||||
|
|
||||||
return JsonUtil.toJsonString(notifyRecipientIds);
|
return JsonUtil.toJsonString(notifyRecipientIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mappings({
|
||||||
|
@Mapping(target = "recipientIds", expression = "java(NotifyConfigConverter.toNotifyRecipientIdsStr(notifyConfigVO.getRecipientIds()))")
|
||||||
|
})
|
||||||
|
NotifyConfig toNotifyConfig(NotifyConfigRequestVO notifyConfigVO);
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@ import com.aizuda.snailjob.template.datasource.access.ConfigAccess;
|
|||||||
import com.aizuda.snailjob.template.datasource.persistence.mapper.JobMapper;
|
import com.aizuda.snailjob.template.datasource.persistence.mapper.JobMapper;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
|
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.mapper.WorkflowMapper;
|
import com.aizuda.snailjob.template.datasource.persistence.mapper.WorkflowMapper;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.GroupConfig;
|
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.Job;
|
import com.aizuda.snailjob.template.datasource.persistence.po.Job;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyConfig;
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyConfig;
|
||||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
|
||||||
@ -37,12 +36,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -161,7 +155,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
|||||||
public Boolean saveNotify(NotifyConfigRequestVO requestVO) {
|
public Boolean saveNotify(NotifyConfigRequestVO requestVO) {
|
||||||
NotifyConfig notifyConfig = NotifyConfigConverter.INSTANCE.toNotifyConfig(requestVO);
|
NotifyConfig notifyConfig = NotifyConfigConverter.INSTANCE.toNotifyConfig(requestVO);
|
||||||
notifyConfig.setCreateDt(LocalDateTime.now());
|
notifyConfig.setCreateDt(LocalDateTime.now());
|
||||||
notifyConfig.setRecipientIds(JsonUtil.toJsonString(requestVO.getNotifyRecipientIds()));
|
notifyConfig.setRecipientIds(JsonUtil.toJsonString(requestVO.getRecipientIds()));
|
||||||
notifyConfig.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
|
notifyConfig.setNamespaceId(UserSessionUtils.currentUserSession().getNamespaceId());
|
||||||
ConfigAccess<NotifyConfig> notifyConfigAccess = accessTemplate.getNotifyConfigAccess();
|
ConfigAccess<NotifyConfig> notifyConfigAccess = accessTemplate.getNotifyConfigAccess();
|
||||||
|
|
||||||
@ -175,7 +169,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
|||||||
public Boolean updateNotify(NotifyConfigRequestVO requestVO) {
|
public Boolean updateNotify(NotifyConfigRequestVO requestVO) {
|
||||||
Assert.notNull(requestVO.getId(), () -> new SnailJobServerException("参数异常"));
|
Assert.notNull(requestVO.getId(), () -> new SnailJobServerException("参数异常"));
|
||||||
NotifyConfig notifyConfig = NotifyConfigConverter.INSTANCE.toNotifyConfig(requestVO);
|
NotifyConfig notifyConfig = NotifyConfigConverter.INSTANCE.toNotifyConfig(requestVO);
|
||||||
notifyConfig.setRecipientIds(JsonUtil.toJsonString(requestVO.getNotifyRecipientIds()));
|
notifyConfig.setRecipientIds(JsonUtil.toJsonString(requestVO.getRecipientIds()));
|
||||||
|
|
||||||
// 防止被覆盖
|
// 防止被覆盖
|
||||||
notifyConfig.setNamespaceId(null);
|
notifyConfig.setNamespaceId(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user