public async Task <HttpResponseMessage> GetClaimInfo([FromUri] UpdateChargeRequest request) { logInfo.Info(string.Format("【收费服务】获取车辆出险信息接口请求串:{0}", Request.RequestUri)); CarClaimViewModel viewModel = new CarClaimViewModel(); 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()); } try { var response = await _chargeService.UpdateClaim(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 = "服务发生异常"; } else { if (response.ErrCode == 0) { viewModel = response.List.ConvertToViewModel(); viewModel.LicenseNo = request.LicenseNo; viewModel.TotalCount = response.TotalCount; viewModel.UsedCount = response.UsedCount; viewModel.BusinessStatus = 1; } else if (response.ErrCode == -2) { viewModel.BusinessStatus = 2;//余额不足 } else if (response.ErrCode == -1) { viewModel.BusinessStatus = 3;//没有获取到 } } } catch (Exception ex) { logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(viewModel.ResponseToJson()); }