private bool Valid(NotifyMessage message, out string errMsg) { errMsg = ""; NotifyMessageBusiness business = new NotifyMessageBusiness(); if (string.IsNullOrEmpty(message.AppId)) { errMsg = "消息的AppId不能为空"; return(false); } if (string.IsNullOrEmpty(message.MessageKey)) { errMsg = "消息的MessageKey不能为空"; return(false); } if (string.IsNullOrEmpty(message.MessageType)) { errMsg = "消息的MessageType不能为空"; return(false); } if (string.IsNullOrEmpty(message.NotifyData)) { errMsg = "消息的NotifyData不能为空"; return(false); } if (string.IsNullOrEmpty(message.SourceFrom)) { errMsg = "消息的SourceFrom不能为空"; return(false); } List <NotifyMessageTypeModel> messageTypeList = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition()); NotifyMessageTypeModel messageTypeMod = messageTypeList.Find(x => x.MessageType.ToString().Equals(message.MessageType, StringComparison.OrdinalIgnoreCase)); if (messageTypeMod == null) { errMsg = "消息类型与系统定义不一致"; Process.Info(message.MessageId, "消息类型初始化验证", "ReceiveMessageBusiness.Valid()", message.MessageKey, string.Format("消息类型与系统定义不一致,消息ID【{0}】,传值类型为【{1}】", message.MessageId, message.MessageType), ""); return(false); } if (message.MessagePriority == MessagePriorityEnum.None) { message.MessagePriority = messageTypeMod.MessagePriority; } return(true); }
/// <summary> /// 获取请求消息列表(分页) /// </summary> /// <param name="con"></param> /// <returns></returns> public List <NotifyMessageModel> GetNotifyMessageList(NotifyMessageCondition con) { NotifyMessageBusiness business = new NotifyMessageBusiness(); var messageTypeList = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition()); List <NotifyMessageEntity> entityList = JinRiNotifyFacade.Instance.GetNotifyMessageList(con); List <NotifyMessageModel> list = new List <NotifyMessageModel>(); entityList.ForEach(x => { var model = MappingHelper.From <NotifyMessageModel, NotifyMessageEntity>(x); var messageType = messageTypeList.Where(t => t.MessageType.ToString().Equals(model.MessageType, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); if (messageType != null) { model.MessageTypeCName = messageType.Remark; } list.Add(model); }); return(list); }
/// <summary> /// 获取配置信息 /// </summary> /// <param name="con">查询条件</param> /// <returns></returns> public List <NotifyInterfaceSettingModel> GetList(NotifyInterfaceSettingCondition condition) { NotifyMessageBusiness business = new NotifyMessageBusiness(); var messageTypeList = business.GetNotifyMessageTypeListFromCache(new NotifyMessageTypeCondition()); List <NotifyInterfaceSettingEntity> entityList = JinRiNotifyFacade.Instance.GetNotifyInterfaceSettingList(condition); List <NotifyInterfaceSettingModel> messageList = new List <NotifyInterfaceSettingModel>(); entityList.ForEach((x) => { var model = MappingHelper.From <NotifyInterfaceSettingModel, NotifyInterfaceSettingEntity>(x); var messageType = messageTypeList.Where(t => t.MessageType == model.MessageType).FirstOrDefault(); if (messageType != null) { model.MessageTypeName = messageType.Remark; } model.MessageTypeEName = x.MessageType.ToString(); messageList.Add(model); }); return(messageList); }