Merge branch 'feature/REQ-1898' into 'pre'

REQ-1898: 调整渠道参数

See merge request universal/infrastructure/backend/msg-center-plat!275
This commit is contained in:
杨林 2024-01-15 08:44:31 +00:00
commit 9c221c0a90

View File

@ -4,7 +4,6 @@ import cn.axzo.basics.common.util.AssertUtil;
import cn.axzo.msg.center.service.dto.PersonV3DTO;
import cn.axzo.msg.center.service.enums.IdentityTypeEnum;
import cn.axzo.msg.center.service.enums.OrganizationTypeEnum;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
@ -16,7 +15,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static java.util.stream.Collectors.toSet;
@ -98,25 +96,23 @@ public class MessageSendReqV3 implements Serializable {
/**
* 渠道参数
*/
private Map<String, Object> channelParams;
private JSONObject channelParams;
public void addChannelParam(String key, Object object) {
if (channelParams == null) {
channelParams = new HashMap<>();
channelParams = new JSONObject();
}
channelParams.put(key, object);
}
public <T> T readChannelParam(String key, Class<T> asType) {
public <T> T getChannelParam(String key, Class<T> asType) {
if (channelParams == null) {
return null;
}
Object value = channelParams.get(key);
if (value == null) {
if (!channelParams.containsKey(key)) {
return null;
}
String json = JSON.toJSONString(value);
return JSON.parseObject(json, asType);
return channelParams.getObject(key, asType);
}
public Collection<PersonV3DTO> distinctReceivers() {