REQ-3444: 调用方控制是否截断参数
This commit is contained in:
parent
ad153db418
commit
2dcc3455e4
@ -31,6 +31,17 @@ public class ExpansionInfo {
|
||||
addExpansion("assign_channel", channel.getCode());
|
||||
}
|
||||
|
||||
public void setVariableAbbreviation(VariableAbbreviation abbreviation) {
|
||||
AssertUtil.notNull(abbreviation, "abbreviation must not be null");
|
||||
addExpansion("abbreviation", abbreviation);
|
||||
}
|
||||
|
||||
public VariableAbbreviation getVariableAbbreviationOrDefault() {
|
||||
JSONObject obj = parseExpansion();
|
||||
VariableAbbreviation abbreviation = obj.getObject("abbreviation", VariableAbbreviation.class);
|
||||
return abbreviation == null ? VariableAbbreviation.defaultAbbreviate() : abbreviation;
|
||||
}
|
||||
|
||||
public void addExpansion(String key, Object value) {
|
||||
JSONObject obj = parseExpansion();
|
||||
obj.put(key, value);
|
||||
|
||||
@ -42,9 +42,4 @@ public class SendMessageRequestDto extends ExpansionInfo {
|
||||
@NotNull(message = "params must not be null")
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 变量过长时,是否截断
|
||||
*/
|
||||
private VariableAbbreviation abbreviation = VariableAbbreviation.defaultAbbreviate();
|
||||
|
||||
}
|
||||
@ -1,11 +1,9 @@
|
||||
package cn.axzo.msg.center.notices.manager.api.dto.request;
|
||||
|
||||
import cn.axzo.msg.center.api.request.ExpansionInfo;
|
||||
import cn.axzo.msg.center.api.request.VariableAbbreviation;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
@ -51,11 +49,6 @@ public class MnsRequestDto extends ExpansionInfo {
|
||||
|
||||
private Object internalObj;
|
||||
|
||||
/**
|
||||
* 变量过长时,是否截断
|
||||
*/
|
||||
private VariableAbbreviation abbreviation = VariableAbbreviation.abbreviate(32);
|
||||
|
||||
public <T> T getInternalObj(Class<T> clazz) {
|
||||
return clazz.isInstance(internalObj) ? clazz.cast(internalObj) : null;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class MessageServiceImpl implements MessageService, EnvironmentAware {
|
||||
// 发送短信
|
||||
try {
|
||||
MessageSendRequestDto dto = new MessageSendRequestDto();
|
||||
dto.setAbbreviation(request.getAbbreviation());
|
||||
dto.setAbbreviation(request.getVariableAbbreviationOrDefault());
|
||||
dto.setAppCode(request.getAppCode());
|
||||
dto.setChannelCode(message.getChannelCode());
|
||||
dto.setPhoneNo(message.getTargetAddress());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user