public async Task <HttpResponseMessage> GetFloatingInfo([FromUri] GetFloatingInfoRequest request)
        {
            _logInfo.Info(string.Format("获取浮动告知单请求串:{0}", Request.RequestUri));
            var viewModel = new GetFloatingInfoViewModel();

            try
            {
                if (!ModelState.IsValid)
                {
                    viewModel.BusinessStatus = -10000;
                    string msg = ModelState.Values.Where(item => item.Errors.Count == 1).Aggregate(string.Empty, (current, item) => current + (item.Errors[0].ErrorMessage + ";   "));
                    viewModel.StatusMessage = "输入参数错误," + msg;
                    return(viewModel.ResponseToJson());
                }
                if (!request.LicenseNo.IsValidLicenseno())
                {
                    viewModel.BusinessStatus = -10000;
                    viewModel.StatusMessage  = "参数校验错误,请检查车牌号";
                    return(viewModel.ResponseToJson());
                }
                GetFloatingInfoResponse response = await _getFloatingInfoService.GetFloatingInfo(request, Request.GetQueryNameValuePairs());

                if (response.Status == HttpStatusCode.BadRequest || response.Status == HttpStatusCode.Forbidden)
                {
                    viewModel.BusinessStatus = -10001;
                    viewModel.StatusMessage  = "参数校验错误,请检查您的校验码";
                    return(viewModel.ResponseToJson());
                }
                if (response.Status == HttpStatusCode.ExpectationFailed)
                {
                    viewModel.BusinessStatus = -10003;
                    viewModel.StatusMessage  = "服务器发生异常";
                    return(viewModel.ResponseToJson());
                }
                //模型转换
                viewModel = response.JSFloatingNotificationPrintList.ConverToViewModel();
                if (response.JSFloatingNotificationPrintList == null)
                {
                    viewModel.BusinessStatus = 0;
                    viewModel.StatusMessage  = "无数据";
                }
                else
                {
                    viewModel.BusinessStatus = 1;
                    viewModel.StatusMessage  = "获取成功";
                }
            }
            catch (Exception ex)
            {
                viewModel.BusinessStatus = -100003;
                viewModel.StatusMessage  = "服务发生异常";
                _logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException + " 请求对象:" + Request.RequestUri);
            }
            return(viewModel.ResponseToJson());
        }
        public async Task <GetFloatingInfoResponse> GetFloatingInfo(GetFloatingInfoRequest request, IEnumerable <KeyValuePair <string, string> > pairs)
        {
            GetFloatingInfoResponse response = new GetFloatingInfoResponse();
            //校验:1基础校验
            BaseResponse baseResponse = _validateService.Validate(request, pairs);

            if (baseResponse.Status == HttpStatusCode.Forbidden)
            {
                response.Status = HttpStatusCode.Forbidden;
                return(response);
            }
            //校验:2报价基础信息
            UserInfoValidateRequest validateRequest = new UserInfoValidateRequest()
            {
                LicenseNo      = request.LicenseNo,
                CustKey        = request.CustKey,
                ChildAgent     = request.ChildAgent == 0 ? request.Agent : request.ChildAgent,
                RenewalCarType = request.RenewalCarType
            };
            //校验2
            var validateResult = _userInfoValidateService.UserInfoValidate(validateRequest);

            if (validateResult.Item1.Status == HttpStatusCode.NotAcceptable)
            {
                response.Status = HttpStatusCode.NotAcceptable;
                return(response);
            }
            //校验:4是否存在核保记录
            bx_submit_info submitInfo = _submitInfoRepository.GetSubmitInfo(validateResult.Item2.Id,
                                                                            SourceGroupAlgorithm.GetOldSource(request.Source));

            string baojiaCacheKey = CommonCacheKeyFactory.CreateKeyWithLicenseAndAgentAndCustKey(request.LicenseNo, request.Agent, request.CustKey + request.RenewalCarType);
            string notifyCacheKey = string.Format("{0}-gzd", baojiaCacheKey);
            //通知中心
            var msgBody = new
            {
                B_Uid          = validateResult.Item2.Id,
                Source         = SourceGroupAlgorithm.GetOldSource(request.Source),
                BiztNo         = submitInfo != null ? submitInfo.biz_tno : "",
                ForcetNo       = submitInfo != null ? submitInfo.force_tno : "",
                NotifyCacheKey = notifyCacheKey
            };

            //发送安心核保消息
            try
            {
                string baojiaKey = string.Format("{0}-Informing", notifyCacheKey);
                CacheProvider.Remove(baojiaKey);

                var msgbody = _messageCenter.SendToMessageCenter(msgBody.ToJson(),
                                                                 ConfigurationManager.AppSettings["MessageCenter"],
                                                                 ConfigurationManager.AppSettings["bxAnXinGaoZhi"]);

                var cacheKey = CacheProvider.Get <string>(baojiaKey);
                if (cacheKey == null)
                {
                    for (int i = 0; i < 180; i++)
                    {
                        cacheKey = CacheProvider.Get <string>(baojiaKey);
                        if (cacheKey != null)
                        {
                            break;
                        }
                        else
                        {
                            await Task.Delay(TimeSpan.FromSeconds(1));
                        }
                    }
                }
                JSFloatingNotificationPrintListResponse jsonModel = new JSFloatingNotificationPrintListResponse();
                if (!string.IsNullOrEmpty(cacheKey))
                {
                    jsonModel = cacheKey.FromJson <JSFloatingNotificationPrintListResponse>();
                }
                response.JSFloatingNotificationPrintList = jsonModel.JSFloatingNotificationPrintListResponseMain;
            }
            catch (MessageException exception)
            {
                response.Status = HttpStatusCode.ExpectationFailed;
                response.ErrMsg = exception.Message;
                return(response);
            }
            return(response);
        }