public bool Handle(EventBus.Events.OrderCompletedEvent evt) { if (evt == null) { return(true); } var orderService = new XuHos.BLL.OrderService(""); var order = orderService.GetOrder(evt.OrderNo); if (order == null) { return(true); } var opd = opdService.Single(order.OrderOutID); if (opd == null) { return(true); } if (opd.IsUseTaskPool && (order.OrderType == Common.Enum.EnumProductType.video || order.OrderType == Common.Enum.EnumProductType.Phone)) { var grabService = new XuHos.BLL.Sys.Implements.SysGrabService <string>(nameof(UserOPDRegister)); grabService.FinishTask(order.OrderOutID, opd.DoctorID); return(true); } else { return(true); } }
public bool Handle(EventBus.Events.OrderPayCompletedEvent evt) { if (evt == null) { return(true); } try { var opd = opdService.Single(evt.OrderOutID); if (opd != null && string.IsNullOrEmpty(opd.DoctorID)) { var room = roomService.GetChannelInfo(opd.OPDRegisterID); if (room != null) { #region 进导诊系统分诊的订单不加入订单池 if (opd.DoctorTriage.IsToGuidance == true) { return(true); } #endregion if (evt.OrderType == Common.Enum.EnumProductType.video || evt.OrderType == Common.Enum.EnumProductType.Phone) { if (evt.PayPrivilege == Common.Enum.EnumPayPrivilege.FamilyDoctor) { grabOPDPriorityPoolService.DispatchTask(evt.OrderOutID, room.Priority, opd.DoctorGroupID); } else { grabOPDPriorityPoolService.DispatchTask(evt.OrderOutID, room.Priority, "ALL"); } return(true); } } } } catch (Exception ex) { XuHos.Common.LogHelper.WriteError(ex); return(false); } return(true); }
public bool Handle(EventBus.Events.OrderPayCompletedEvent evt) { var LockName = $"{typeof(SendBizNotice)}:{evt.OrderNo}"; var lockValue = Guid.NewGuid().ToString("N"); //获取分布式锁,获取锁失败时进行锁等待(锁超时时间5秒) if (LockName.Lock(lockValue, TimeSpan.FromSeconds(5))) { try { #region 发送业务通知 var opd = opdService.Single(evt.OrderOutID); #region 需分诊的订单,等分诊后再处理 if (opd.DoctorTriage.IsToGuidance == true) { return(true); } #endregion if (opd != null) { var noticeType = EnumNoticeSecondType.AllNotice; var ServiceType = EnumDoctorServiceType.VidServiceType; //图文消息 if (evt.OrderType == EnumProductType.ImageText) { noticeType = EnumNoticeSecondType.DoctorPicNotice; ServiceType = EnumDoctorServiceType.PicServiceType; } //家庭医生 else if (evt.OrderType == EnumProductType.FamilyDoctor) { noticeType = EnumNoticeSecondType.DoctorFamilyNotice; ServiceType = EnumDoctorServiceType.FamilyDoctor; } //语音或视频咨询 else if (evt.OrderType == EnumProductType.video) { noticeType = EnumNoticeSecondType.DoctorVidNotice; ServiceType = EnumDoctorServiceType.VidServiceType; } //语音或视频咨询 else if (evt.OrderType == EnumProductType.Phone) { noticeType = EnumNoticeSecondType.DoctorVidNotice; ServiceType = EnumDoctorServiceType.AudServiceType; } //远程会诊 else if (evt.OrderType == EnumProductType.Consultation) { noticeType = EnumNoticeSecondType.DoctorConsulNotice; ServiceType = EnumDoctorServiceType.Consultation; } using (XuHos.EventBus.MQChannel mqChannel = new EventBus.MQChannel()) { return(mqChannel.Publish <EventBus.Events.UserNoticeEvent>(new EventBus.Events.UserNoticeEvent() { NoticeType = noticeType, ServiceID = evt.OrderOutID, ServiceType = ServiceType })); } } #endregion } catch (Exception ex) { Common.LogHelper.WriteError(ex); return(false); } finally { LockName.UnLock(lockValue); } } else { return(false); } return(true); }
public ApiResult GetEntity([FromUri] string OPDRegisterID) { BLL.UserOPDRegisterService bll = new UserOPDRegisterService(CurrentOperatorUserID); return(bll.Single(OPDRegisterID, CurrentOperatorUserType == EnumUserType.User ? true : false).ToApiResultForObject()); }