feat:REQ-1419 移除消息模板服务依赖

This commit is contained in:
zuoqinbo 2023-10-20 10:59:38 +08:00
parent af67ade3f1
commit d2be4df29d
3 changed files with 23 additions and 6 deletions

View File

@ -22,10 +22,11 @@ public class MessageInfo {
/**
* 发送消息到App端
* 工人端企业端服务器
* cmcmpsystem
* WORKERENTERPRISESYSTEM
*
* @See cn.axzo.im.center.common.enums.AppTypeEnum
*/
@NotNull(message = "消息接收端类型列表")
@NotNull(message = "消息接收端类型appTypeList不能为空")
private List<AppTypeEnum> appTypeList;

View File

@ -3,6 +3,8 @@ package cn.axzo.im.center.common.enums;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
import java.util.List;
/**
* App消息应用终端类型
@ -37,6 +39,20 @@ public enum AppTypeEnum {
}
public static AppTypeEnum isValidAppType(List<AppTypeEnum> appTypeList) {
if (appTypeList == null) {
return null;
}
AppTypeEnum[] appTypeEnums = AppTypeEnum.values();
for (AppTypeEnum appTypeEnum : appTypeEnums) {
if (appTypeEnum.getCode().equals("appType.toLowerCase()")) {
return appTypeEnum;
}
}
return null;
}
public static AppTypeEnum isValidAppType(String appType) {
if (StringUtils.isBlank(appType)) {
return null;

View File

@ -99,11 +99,11 @@ public class MessageService {
throw new ServiceException("暂未支持普通用户[" + messageInfo.getPersonId() + "]发送IM消息");
}
//如果消息模板是多端则分开进行发送消息
List<String> appTypeList = messageInfo.getAppTypeList();
List<AppTypeEnum> appTypeList = messageInfo.getAppTypeList();
List<MessageDispatchResp> messageDispatchResps = Lists.newArrayList();
appTypeList.forEach(appType -> {
if (AppTypeEnum.isValidAppType(appType) == null) {
throw new ServiceException("当前appType,服务器不支持该类型!!");
if (appType == null || AppTypeEnum.isValidAppType(appType.getCode()) == null) {
throw new ServiceException("当前服务器不支持该appType类型!");
}
List<String> toPersonList = messageInfo.getToPersonIdList();
List<String> toPersonImList = Lists.newArrayList();