public Task <Unit> Handle(EditStaffCommand request, CancellationToken cancellationToken)
        {
            try
            {
                // 命令验证
                if (!request.IsValid())
                {
                    // 错误信息收集
                    NotifyValidationErrors(request);
                    return(Task.FromResult(new Unit()));
                }
                var staffInfo    = _mapper.Map <EditStaffCommand, Staff>(request);
                var oldStaffInfo = _staffRepository.Get(request.Id);
                if (oldStaffInfo == null)
                {
                    _bus.RaiseEvent(new DomainNotification("", "目标记录不存在"));
                    return(Task.FromResult(new Unit()));
                }
                // 判断组织机构编码或名称是否存在
                // 这些业务逻辑,当然要在领域层中(领域命令处理程序中)进行处理

                if (oldStaffInfo.Account != request.Account && _staffRepository.GetAll(x => x.Account == request.Account).Any())
                {
                    _bus.RaiseEvent(new DomainNotification("", "Account已存在!"));
                    return(Task.FromResult(new Unit()));
                }
                if (!string.IsNullOrWhiteSpace(request.Mobile) && oldStaffInfo.Mobile != request.Mobile && _staffRepository.GetAll(x => x.Mobile == request.Mobile).Any())
                {
                    _bus.RaiseEvent(new DomainNotification("", "手机号已存在!"));
                    return(Task.FromResult(new Unit()));
                }
                if (!string.IsNullOrWhiteSpace(request.Email) && oldStaffInfo.Email != request.Email && _staffRepository.GetAll(x => x.Email == request.Email).Any())
                {
                    _bus.RaiseEvent(new DomainNotification("", "邮箱已存在!"));
                    return(Task.FromResult(new Unit()));
                }
                if (!_officeRepository.GetAll(x => x.Id == request.OfficeId).Any())
                {
                    _bus.RaiseEvent(new DomainNotification("", "所选组织机构不存在!"));
                    return(Task.FromResult(new Unit()));
                }
                if (request.RoleList != null && request.RoleList.Any() && _roleRepository.GetAll(x => request.RoleList.Contains(x.Id)).Count() == request.RoleList.Length)
                {
                    _bus.RaiseEvent(new DomainNotification("", "所选角色不存在!"));
                    return(Task.FromResult(new Unit()));
                }
                oldStaffInfo.Account    = staffInfo.Account;
                oldStaffInfo.NickName   = staffInfo.NickName;
                oldStaffInfo.StaffType  = staffInfo.StaffType;
                oldStaffInfo.State      = staffInfo.State;
                oldStaffInfo.UpdateBy   = staffInfo.UpdateBy;
                oldStaffInfo.UpdateDate = staffInfo.UpdateDate;
                oldStaffInfo.Remark     = staffInfo.Remark;
                oldStaffInfo.Mobile     = staffInfo.Mobile;
                oldStaffInfo.Email      = staffInfo.Email;
                _staffRepository.Update(oldStaffInfo);
                _staffRoleRepository.RemoveAndInsert(staffInfo.Id, (request.RoleList != null && request.RoleList.Any()) ? request.RoleList : new Guid[0]);
                // 统一提交
                if (!Commit())
                {
                    throw new AggregateException("提交失败");
                }
            }
            catch (Exception e)
            {
                _bus.RaiseEvent(new DomainNotification("", $"系统异常,发生未知错误:{e.Message}"));
            }
            return(Task.FromResult(new Unit()));
        }