public async Task <HttpResponseMessage> GetSubmitInfo([FromUri] GetSubmitInfoRequest request) { _logAppInfo.Info(string.Format("获取核保信息接口请求串:{0}", Request.RequestUri)); var viewModel = new SubmitInfoNewViewModel(); 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()); } viewModel = await _appAchieveService.GetSubmitInfo(request, Request.GetQueryNameValuePairs(), Request.RequestUri); //_logAppInfo.Info(string.Format("获取核保信息接口返回值:{0}", viewModel.ToJson())); return(viewModel.ResponseToJson()); }
public async Task <SubmitInfoNewViewModel> GetSubmitInfo(GetSubmitInfoRequest request, IEnumerable <KeyValuePair <string, string> > pairs, Uri uri) { var viewModel = new SubmitInfoNewViewModel(); #region 参数校验 //校验请求串 var baseRequest = new AppBaseRequest() { Agent = request.Agent, SecCode = request.SecCode, CustKey = request.CustKey, BhToken = request.BhToken, ChildAgent = request.ChildAgent }; //校验返回值 var baseResponse = _appVerifyService.Verify(baseRequest, pairs); if (baseResponse.ErrCode != 1) { viewModel.BusinessStatus = baseResponse.ErrCode; viewModel.StatusMessage = baseResponse.ErrMsg; return(viewModel); } #endregion #region 业务逻辑 //拼接请求串 string strUrl = string.Format("http://{0}:{1}/api/CarInsurance/GetSubmitInfo", uri.Host, uri.Port); //3,续保请求 BaseResponse rep = await SimulateGet(strUrl, pairs); if (rep.ErrCode == 1) { viewModel = rep.ErrMsg.FromJson <SubmitInfoNewViewModel>(); } else { viewModel.BusinessStatus = rep.ErrCode; viewModel.StatusMessage = rep.ErrMsg; } bx_userinfo userinfo = _userInfoRepository.FindByOpenIdAndLicense(request.CustKey, request.LicenseNo, request.ChildAgent.ToString(), request.RenewalCarType); viewModel.Buid = userinfo != null ? userinfo.Id : 0; viewModel.Agent = baseResponse.Agent; viewModel.AgentName = baseResponse.AgentName; #endregion return(viewModel); }