public HttpResponseMessage GetBjdDetailFromHistory([FromUri] GetBjdDetailFromHistoryRequest request) { logInfo.Info(string.Format("从历史获取报价详情接口请求串:{0}", Request.RequestUri)); var viewModel = new MyBaoJiaViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } try { MyBaoJiaViewModel response = new MyBaoJiaViewModel(); response = _bjdService.GetBjdDetailFromHistory(request, Request.GetQueryNameValuePairs()); viewModel = response; viewModel.BusinessStatus = 1; } catch (Exception ex) { logError.Info("获取报价单详情接口发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(viewModel.ResponseToJson()); }
public MyBaoJiaViewModel CheckRequest(bx_userinfo userInfo, GetMyBjdDetailRequest request) { var my = new MyBaoJiaViewModel(); if (userInfo == null || userInfo.Id == 0) { my.BusinessStatus = -10000; my.StatusMessage = "无法获取数据"; return(my); } if (request.NewRate != null && !SourceGroupAlgorithm.ParseSource((int)userInfo.IsSingleSubmit).Contains(8)) { my.BusinessStatus = 0; my.StatusMessage = "没有找到国寿财报价信息"; return(my); } BaseResponse baseResponse = _validateService.ValidateAgent(request, userInfo); if (baseResponse.Status == HttpStatusCode.Forbidden) { my.BusinessStatus = -10000; my.StatusMessage = "请求数据无权限"; } else { my.BusinessStatus = 1; } return(my); }
public MyBaoJiaViewModel SetOrder(MyBaoJiaViewModel my, bx_userinfo userInfo) { //CarOrderStatusModel bxCarOrder = _orderRepository.GetOrderStatus(userInfo.Id); //if (bxCarOrder != null) //{ // my.HasOrder = 1; // my.OrderId = bxCarOrder.Id; // my.OrderStatus = bxCarOrder.OrderStatus.HasValue ? bxCarOrder.OrderStatus.Value : 0; //} //else //{ my.HasOrder = 0; my.OrderId = 0; my.OrderStatus = 0; //} if (!string.IsNullOrEmpty(userInfo.LicenseNo)) { my.LicenseNo = userInfo.LicenseNo; var carInfo = _carInfoRepository.Find(userInfo.LicenseNo); my.PurchasePrice = carInfo != null ? (carInfo.purchase_price.HasValue ? carInfo.purchase_price.Value.ToString() : "0") : "0"; } else { my.LicenseNo = ""; my.PurchasePrice = "0"; } return(my); }
public HttpResponseMessage GetMyBjdDetail([FromUri] GetMyBjdDetailRequest request) { string traceId = LogAssistant.GetRequestHeaders(Request, "TraceId"); BHFunctionLog fucnLog = LogAssistant.GenerateBHFuncLog(traceId, "service层获取获取我的报价单接口", "GetMyBjdDetail", 1); logInfo.Info(string.Format("获取我的报价单详情接口请求串:{0}", Request.RequestUri)); var viewModel = new MyBaoJiaViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } try { MyBaoJiaViewModel response = new MyBaoJiaViewModel(); AspectF.Define.InfoFunctionLog(fucnLog).Do(() => { response = _bjdService.GetMyBjdDetail(request, Request.GetQueryNameValuePairs()); }); viewModel = response; } catch (Exception ex) { logError.Info("获取报价单详情接口发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(viewModel.ResponseToJson()); }
public HttpResponseMessage GetPrecisePriceDetail([FromUri] GetMyBjdDetailRequest request) { _logAppInfo.Info(string.Format("获取报价详情接口请求串:{0}", Request.RequestUri)); var viewModel = new MyBaoJiaViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(a => a.Errors.Count == 1).Aggregate(string.Empty, (current, a) => current + (a.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } viewModel = _appAchieveService.GetPrecisePriceDetail(request, Request.GetQueryNameValuePairs(), Request.RequestUri); //_logAppInfo.Info(string.Format("获取报价详情接口返回值:{0}", viewModel.ToJson())); return(viewModel.ResponseToJson()); }
public MyBaoJiaViewModel SetAgent(MyBaoJiaViewModel my, bx_userinfo userinfo, GetMyBjdDetailRequest request) { var curAgent = _agentRepository.GetAgent(int.Parse(userinfo.Agent)); my.CurAgentName = curAgent != null ? curAgent.AgentName : string.Empty; my.CurAgentMobile = curAgent != null ? curAgent.Mobile : string.Empty; //初始化不显示费率 0为显示 my.IsShowCalc = 1; if (request.ChildAgent != 0) { bx_agent bxAgent = _agentRepository.GetAgent(request.ChildAgent); my.IsShowCalc = bxAgent != null ? (bxAgent.IsShow.HasValue ? bxAgent.IsShow.Value : 1) : 1; } return(my); }
public MyBaoJiaViewModel SetActivities(MyBaoJiaViewModel my, GetMyBjdDetailRequest request) { my.Activity = new List <PreActivity>(); if (!string.IsNullOrWhiteSpace(request.Activity)) { var preActivity = _preferentialActivityRepository.GetActivityByIds(request.Activity.Trim()); var activity = preActivity.Select( model => new PreActivity { ActivityName = model.activity_name, ActivityContent = model.activity_content }).ToList(); my.Activity = activity; } return(my); }
public MyBaoJiaViewModel SetClaims(MyBaoJiaViewModel my, GetMyBjdDetailRequest request, bx_userinfo userinfo) { List <bx_claim_detail> claimlist = _userClaimRepository.FindList(userinfo.Id); //此处不再给ClaimCount赋值,因为平安拿不到信息。总计从lastinfo取 if (request.IsNewClaim == 1) { my.ClaimItem = claimlist.ConvertToNewDetailList(); my.ClaimDetail = new List <ClaimDetailViewModel>(); } else { my.ClaimItem = new List <UserClaimDetailViewModel>(); my.ClaimDetail = claimlist.ConvertToNewList(); } return(my); }
public MyBaoJiaViewModel GetPrecisePriceDetail(GetMyBjdDetailRequest request, IEnumerable <KeyValuePair <string, string> > pairs, Uri uri) { var viewModel = new MyBaoJiaViewModel(); #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/Bjd/GetMyBjdDetail", uri.Host, uri.Port); //3,续保请求 BaseResponse rep = SimulateSyncGet(strUrl, pairs); if (rep.ErrCode == 1) { viewModel = rep.ErrMsg.FromJson <MyBaoJiaViewModel>(); } else { viewModel.BusinessStatus = rep.ErrCode; viewModel.StatusMessage = rep.ErrMsg; } //bx_userinfo userinfo = _userInfoRepository.FindByOpenIdAndLicense(request.CustKey, request.LicenseNo, request.ChildAgent.ToString()); //viewModel.Buid = userinfo != null ? userinfo.Id : 0; //viewModel.Agent = userinfo.Agent; //viewModel.AgentName = baseResponse.AgentName; #endregion return(viewModel); }
public MyBaoJiaViewModel SetCarInfo(MyBaoJiaViewModel my, bx_userinfo userInfo, out List <bx_quoteresult_carinfo> quoteresultCarinfo) { quoteresultCarinfo = _quoteResultCarinfoRepository.FindList(userInfo.Id);//, item.Source.Value my.CarInfos = new List <DiffCarInfo>(); foreach (var car in quoteresultCarinfo) { my.CarInfos.Add(new DiffCarInfo { Source = car.source.HasValue ? SourceGroupAlgorithm.GetNewSource(car.source.Value) : 0, AutoMoldCode = string.IsNullOrWhiteSpace(car.auto_model_code) ? string.Empty : car.auto_model_code, CarSeat = car.seat_count.HasValue ? car.seat_count.Value : 0, VehicleInfo = VehicleInfoMapper.VehicleInfoMethod(car), Risk = car.risk, XinZhuanXu = car.IsZhuanXubao, SyVehicleClaimType = car.SyVehicleClaimType, JqVehicleClaimType = car.JqVehicleClaimType, VehicleStyle = car.VehicleStyle, VehicleAlias = car.VehicleAlias, VehicleYear = car.VehicleYear }); } return(my); }
/// <summary> /// 百得利从报价历史获取关系人信息 /// </summary> /// <param name="my"></param> /// <param name="userInfo"></param> /// <param name="relatedhistory"></param> /// <returns></returns> public MyBaoJiaViewModel SetBaseInfoHistory(MyBaoJiaViewModel my, bx_userinfo userInfo, bx_quotehistory_related relatedhistory) { my.Holder = new Holder { HolderName = relatedhistory.holder_name ?? string.Empty, HolderIdType = relatedhistory.holder_id_type.HasValue ? relatedhistory.holder_id_type.Value : 0, HolderIdCard = relatedhistory.holder_id_card ?? string.Empty, HolderMobile = relatedhistory.holder_mobile ?? string.Empty, HolderAddress = relatedhistory.holder_address ?? string.Empty, HolderEmail = relatedhistory.holder_email ?? string.Empty }; my.CarOwnerPerson = new RelationPerson { Address = relatedhistory.ower_address ?? string.Empty, Email = relatedhistory.ower_email ?? string.Empty, IdCard = relatedhistory.ower_id_card ?? string.Empty, IdType = relatedhistory.ower_id_type ?? 0, Mobile = relatedhistory.holder_mobile ?? string.Empty, Name = relatedhistory.ower_name ?? string.Empty, Sex = relatedhistory.ower_sex ?? 1, Authority = relatedhistory.ower_authority ?? string.Empty, Birthday = (!relatedhistory.ower_birthday.HasValue) ? "" : Convert.ToDateTime(relatedhistory.ower_birthday.Value).Year == DateTime.MinValue.Year ? "" : relatedhistory.ower_birthday.Value.ToString("yyyy-MM-dd"), CertiEndDate = (!relatedhistory.ower_certi_end_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.ower_certi_end_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.ower_certi_end_date.Value.ToString("yyyy-MM-dd"), CertiStartDate = (!relatedhistory.ower_certi_start_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.ower_certi_start_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.ower_certi_start_date.Value.ToString("yyyy-MM-dd"), Nation = relatedhistory.ower_nation ?? string.Empty }; my.HolderPerson = new RelationPerson { Address = relatedhistory.holder_address ?? string.Empty, Email = relatedhistory.holder_email ?? string.Empty, IdCard = relatedhistory.holder_id_card ?? string.Empty, IdType = relatedhistory.holder_id_type ?? 0, Mobile = relatedhistory.holder_mobile ?? string.Empty, Name = relatedhistory.holder_name ?? string.Empty, Sex = relatedhistory.holder_sex ?? 1, Authority = relatedhistory.holder_authority ?? string.Empty, Birthday = (!relatedhistory.holder_birthday.HasValue) ? "" : Convert.ToDateTime(relatedhistory.holder_birthday.Value).Year == DateTime.MinValue.Year ? "" : relatedhistory.holder_birthday.Value.ToString("yyyy-MM-dd"), CertiEndDate = (!relatedhistory.holder_certi_end_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.holder_certi_end_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.holder_certi_end_date.Value.ToString("yyyy-MM-dd"), CertiStartDate = (!relatedhistory.holder_certi_start_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.holder_certi_start_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.holder_certi_start_date.Value.ToString("yyyy-MM-dd"), Nation = relatedhistory.holder_nation ?? string.Empty }; my.InsuredPerson = new RelationPerson { Address = relatedhistory.insured_address ?? string.Empty, Email = relatedhistory.insured_email ?? string.Empty, IdCard = relatedhistory.insured_id_card ?? string.Empty, IdType = relatedhistory.insured_id_type ?? 0, Mobile = relatedhistory.insured_mobile ?? string.Empty, Name = relatedhistory.insured_name ?? string.Empty, Sex = relatedhistory.insured_sex ?? 1, Authority = relatedhistory.insured_authority ?? string.Empty, Birthday = (!relatedhistory.insured_birthday.HasValue) ? "" : Convert.ToDateTime(relatedhistory.insured_birthday.Value).Year == DateTime.MinValue.Year ? "" : relatedhistory.insured_birthday.Value.ToString("yyyy-MM-dd"), CertiEndDate = (!relatedhistory.insured_certi_end_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.insured_certi_end_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.insured_certi_end_date.Value.ToString("yyyy-MM-dd"), CertiStartDate = (!relatedhistory.insured_certi_start_date.HasValue) ? "" : Convert.ToDateTime(relatedhistory.insured_certi_start_date).Year == DateTime.MinValue.Year ? "" : relatedhistory.insured_certi_start_date.Value.ToString("yyyy-MM-dd"), Nation = relatedhistory.insured_nation ?? string.Empty }; my.SubmitGroup = userInfo.Source.HasValue ? (userInfo.Source.Value > 0 ? userInfo.Source.Value : 0) : 0;//核保类型 my.CurOpenId = userInfo.OpenId; my.CurAgent = userInfo.Agent; my.MoldName = !string.IsNullOrEmpty(userInfo.MoldName) ? userInfo.MoldName : string.Empty; my.UserName = !string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName : string.Empty; my.LicenseOwner = my.CarOwnerPerson.Name; my.Buid = userInfo.Id; my.RegisterDate = !string.IsNullOrEmpty(userInfo.RegisterDate) ? userInfo.RegisterDate : string.Empty; //InsuredName和PostedName是一个字段,被保险人姓名 my.InsuredName = my.InsuredPerson.Name; my.PostedName = my.InsuredPerson.Name; //被保险人电话 my.InsuredMobile = my.InsuredPerson.Mobile; //被保险人地址 my.InsuredAddress = my.InsuredPerson.Address; //被保险人证件类型 my.InsuredIdType = my.InsuredPerson.IdType; //车主证件类型 my.IdType = my.CarOwnerPerson.IdType;//_quoteResultCarinfoRepository.GetOwnerIdType(userInfo.Id); my.IdCard = my.CarOwnerPerson.IdCard; //my.IdType = userInfo.InsuredIdType.HasValue ? userInfo.InsuredIdType.Value : 0; my.CredentislasNum = my.CarOwnerPerson.IdCard; my.InsuredIdCard = my.InsuredPerson.IdCard; my.CityCode = !string.IsNullOrEmpty(userInfo.CityCode) ? userInfo.CityCode : string.Empty; my.EngineNo = !string.IsNullOrEmpty(userInfo.EngineNo) ? userInfo.EngineNo : string.Empty; my.CarVin = !string.IsNullOrEmpty(userInfo.CarVIN) ? userInfo.CarVIN : string.Empty; //获取电子保单的邮箱地址 //my.Email = !string.IsNullOrEmpty(userInfo.Email) ? userInfo.Email : string.Empty; my.Email = !string.IsNullOrEmpty(userInfo.InsuredEmail) ? userInfo.InsuredEmail : string.Empty; my.Email = !string.IsNullOrEmpty(my.Email) ? my.Email : userInfo.Email; my.QuoteGroup = userInfo.IsSingleSubmit.HasValue ? userInfo.IsSingleSubmit.Value : 0; //报价类型 my.HasBaojia = my.QuoteGroup == 0 ? 0 : 1; if (my.QuoteGroup > 0) //(userinfo.QuoteStatus > -1) { my.HasBaojia = 1; //是否报过价 my.QuoteTime = userInfo.UpdateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } else { my.HasBaojia = 0; my.QuoteTime = ""; } if (string.IsNullOrWhiteSpace(my.QuoteTime)) { my.IsTheDay = 2; } else { my.IsTheDay = Convert.ToDateTime(my.QuoteTime).ToShortDateString() == DateTime.Now.ToShortDateString() ? 1 : 2; } my.SixDigitsAfterIdCard = userInfo.SixDigitsAfterIdCard ?? ""; return(my); }
public MyBaoJiaViewModel GetMyBjdDetail(GetBjdDetailFromHistoryRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { DateTime date1 = DateTime.Now; bx_userinfo userinfo = _userInfoRepository.FindByBuid(request.Buid); var my = new MyBaoJiaViewModel(); //校验 //var my = _checkRequestService.CheckRequest(userinfo, request); //if (my.BusinessStatus != 1) //{ // return my; //} Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> > historyList = _getModelsFromQuoteHistory.GetModels(request.Buid, request.GroupSpan); List <long> quote01 = new List <long>(); //报价1+0的数据 成功+失败 List <long> quote1 = new List <long>(); //报价1的数据 成功 if (historyList.Item4 != null && historyList.Item4.Any()) { List <int> intquote1 = historyList.Item4.Where(w => w.quote_status > 0).Select(l => l.source.Value).ToList(); if (intquote1 != null && intquote1.Any()) { foreach (var i in intquote1) { quote1.Add(i); } } } if (historyList.Item6.Any()) { foreach (var i in historyList.Item6) { quote01.Add(i); } } //获取修改时间 my.UpdateTime = historyList.Item5; //获取在该报价单在预约单中记录 my = _setOrderNewService.SetOrder(my, userinfo); //从userinfo获取关系人 和一些其他配置 var relationitem = _quotehistoryRelatedRepository.GetModel(request.Buid, request.GroupSpan); if (relationitem != null && relationitem.id > 0) { my = _setBaseInfoHistoryService.SetBaseInfoHistory(my, userinfo, relationitem); } else { my = _setBaseInfoService.SetBaseInfo(my, userinfo); } List <bx_quoteresult_carinfo> quoteresultCarinfo; //获取车辆信息 my = _setCarInfoService.SetCarInfo(my, userinfo, out quoteresultCarinfo); //取商业险和交强险开始时间 Tuple <string, string> startDate = _getDateNewService.GetDate(historyList.Item3); string postBizStartDate = startDate.Item1; //商业险起始时间 string postForceStartDate = startDate.Item2; //交强险起始时间 //请求报价的信息 my = _setQuoteReqNewService.SetQuoteReq(my, quote1, historyList.Item2, ref postBizStartDate, ref postForceStartDate); //给交强商业起始时间、到期时间赋值 //顺便给出险次数赋值。因为平安从bx_claimdetails没办法拿值,中心沟通从此表取值 my = _setDateService.SetDate(my, userinfo, postBizStartDate, postForceStartDate); GetMyBjdDetailRequest request1 = new GetMyBjdDetailRequest() { Agent = request.Agent, Source = -1, NewRate = null }; my = _setPrecisePriceItemNewService.SetPrecisePriceItem(my, userinfo, quoteresultCarinfo, quote01, quote1.Count == 0, historyList.Item1, historyList.Item3, historyList.Item4); //获取出险记录 //my = _setClaimsService.SetClaims(my, request, userinfo); //获取优惠活动 //my = _setActivitiesService.SetActivities(my, request); //获取图片 //my.Images = _imagesRepository.FindByBuid(userinfo.Id); my.Images = new List <bx_images>(); //是否是临时被保险人 my.IsTempInsured = GetTempInsured(userinfo.Id); //赋值代理人信息,并初始化费率 展示费率 //my = _setAgentService.SetAgent(my, userinfo, request); my.QuoteTime = historyList.Item5; //userinfo.LatestQuoteTime.HasValue ? userinfo.LatestQuoteTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; my.LatestRenewalTime = ""; // userinfo.LatestRenewalTime.HasValue ? userinfo.LatestRenewalTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; return(my); }
public MyBaoJiaViewModel SetPrecisePriceItem(MyBaoJiaViewModel my, bx_userinfo userinfo, List <bx_quoteresult_carinfo> quoteresultCarinfo, List <long> listquote01, bool allfail, bx_savequote sq, List <bx_quoteresult> qrList, List <bx_submit_info> siList) { string newRate = string.Empty; //var sourceList = _setPrecisePriceItem.FindSource(userinfo, request); //获取图片bx_picture //List<bx_picture> picList = _pictureRepository.GetAllList(o => o.b_uid == userinfo.Id); //报价单资源对象 //bx_savequote sq = _saveQuoteRepository.GetSavequoteByBuid(userinfo.Id); //List<bx_quoteresult> qrList = _quoteResultRepository.GetQuoteResultList(userinfo.Id); //List<bx_submit_info> siList = _submitInfoRepository.GetSubmitInfoList(userinfo.Id); //渠道列表 List <AgentConfigNameModel> agentChannelList = new List <AgentConfigNameModel>(); if (siList.Any()) { agentChannelList = _agentConfigRepository.FindListById(siList.Select(l => l.channel_id).Join(",")); } //图片url List <IsUploadImg> isUploadImg = new List <IsUploadImg>(); //报价信息模型,包括险种和报价 List <MyPrecisePriceItemViewModel> listquoteTotal = new List <MyPrecisePriceItemViewModel>(); var hebaodianweis = _hebaoDianweiRepository.FindList(userinfo.Id, listquote01.ToArray()); if (listquote01.Any()) { foreach (int oit in listquote01) { //20160905修改source1248=>0123,传入的新数据转换 var submit = siList.FirstOrDefault(i => i.source == oit); var qr = qrList.FirstOrDefault(i => i.Source == oit); if (oit == 3) { if (!string.IsNullOrEmpty(newRate) && qr != null) { qr.NewRate = decimal.Parse(newRate); _quoteResultRepository.Update(qr); } else if (string.IsNullOrEmpty(newRate) && qr != null && qr.NewRate != 0 && qr.NewRate != null) { newRate = qr.NewRate.ToString(); } if (!string.IsNullOrEmpty(newRate)) { my.NewRate = double.Parse(newRate).ToString("#0.00000"); } } var model = ConvertToViewModelNew(oit, sq, qr, submit, allfail, agentChannelList, userinfo.CarVIN, newRate); var hebaodianwei = hebaodianweis.FirstOrDefault(heb => heb.source == oit); if (hebaodianwei != null && my.IsShowCalc == 0) { model.BizSysRate = hebaodianwei.system_biz_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_biz_rate.Value) : 0; model.ForceSysRate = hebaodianwei.system_force_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_force_rate.Value) : 0; //优惠费率 model.BenefitRate = hebaodianwei.agent_id == hebaodianwei.parent_agent_id ? Convert.ToDecimal(hebaodianwei.zhike_biz_rate.Value) : Convert.ToDecimal(hebaodianwei.agent_biz_rate.Value); } var qcinfo = quoteresultCarinfo.FirstOrDefault(l => l.source == oit); if (qcinfo != null) { model.CarUsedType = qcinfo.car_used_type.HasValue ? qcinfo.car_used_type.Value : 0; } model.JingSuanKouJing = submit != null ? (submit.RbJSKJ ?? "") : ""; listquoteTotal.Add(model); } my.PrecisePriceItem = listquoteTotal; my.IsUploadImg = new List <IsUploadImg>(); } else { my.PrecisePriceItem = new List <MyPrecisePriceItemViewModel>(); } return(my); }
public MyBaoJiaViewModel SetDate(MyBaoJiaViewModel my, bx_userinfo userinfo, string postBizStartDate, string postForceStartDate) { #region 格式化并赋值商业交强起保时间 if (!string.IsNullOrWhiteSpace(postForceStartDate)) { var st = DateTime.Parse(postForceStartDate); if (st.Date == DateTime.MinValue.Date) { postForceStartDate = ""; } } if (!string.IsNullOrWhiteSpace(postBizStartDate)) { var st = DateTime.Parse(postBizStartDate); if (st.Date == DateTime.MinValue.Date) { postBizStartDate = ""; } } my.ForceStartDate = postForceStartDate; //crm前端不用,app、微信在用 my.BizStartDate = postBizStartDate; //crm前端不用,app、微信在用 my.PostStartDate = new PostStartDateTime() { //crm前端在用 BusinessStartDate = postBizStartDate, ForceStartDate = postForceStartDate }; #endregion #region 赋值商业交强结束时间 var lastInfo = _lastInfoRepository.GetEndDateAndClaim(userinfo.Id); if (lastInfo != null) { my.LastBusinessEndDdate = string.IsNullOrEmpty(lastInfo.LastBusinessEndDdate) ? string.Empty : lastInfo.LastBusinessEndDdate; my.LastEndDate = string.IsNullOrEmpty(lastInfo.LastForceEndDdate) ? string.Empty : lastInfo.LastForceEndDdate; if (!string.IsNullOrWhiteSpace(my.LastBusinessEndDdate)) { var st = DateTime.Parse(my.LastBusinessEndDdate); if (st.Date == DateTime.MinValue.Date) { my.LastBusinessEndDdate = string.Empty; } } if (!string.IsNullOrWhiteSpace(my.LastEndDate)) { var st = DateTime.Parse(my.LastEndDate); if (st.Date == DateTime.MinValue.Date) { my.LastEndDate = string.Empty; } } //addbygpj20181106新增商业交强出险次数,从lastinfo取。 my.ForceCliamCount = lastInfo.ForceClaimCount; my.BizClaimCount = lastInfo.BizClaimCount; } else { my.LastBusinessEndDdate = string.Empty; my.LastEndDate = string.Empty; } #endregion return(my); }
public MyBaoJiaViewModel SetQuoteReq(MyBaoJiaViewModel my, bx_userinfo userinfo, ref string postBizStartDate, ref string postForceStartDate) { var quotereqCarInfo = _quoteReqCarinfoRepository.Find(userinfo.Id); my.IsNewCar = 2;//默认赋值旧车2 //公车私车 if (quotereqCarInfo != null) { //报价失败,取req表起保时间 if (userinfo.QuoteStatus < 1) { postForceStartDate = quotereqCarInfo.force_start_date.HasValue ? quotereqCarInfo.force_start_date.Value.ToString("yyyy-MM-dd HH:mm") : ""; postBizStartDate = quotereqCarInfo.biz_start_date.HasValue ? quotereqCarInfo.biz_start_date.Value.ToString("yyyy-MM-dd HH:mm") : ""; } my.IsPublic = quotereqCarInfo.is_public.HasValue ? quotereqCarInfo.is_public.Value : 0; if (quotereqCarInfo.is_newcar.HasValue) { if (quotereqCarInfo.is_newcar.Value != 0) { my.IsNewCar = quotereqCarInfo.is_newcar.Value; } } my.AutoMoldCode = quotereqCarInfo.auto_model_code; my.CoRealValue = quotereqCarInfo.co_real_value.HasValue ? quotereqCarInfo.co_real_value.Value : 0; my.CarUsedType = quotereqCarInfo.car_used_type; my.SeatCount = quotereqCarInfo.seat_count; my.IsLoans = quotereqCarInfo.is_loans.HasValue ? quotereqCarInfo.is_loans.Value : -1; my.TransferDate = quotereqCarInfo.transfer_date.HasValue ? quotereqCarInfo.transfer_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; //报价返回请求值 my.ReqInfo = new QuoteReqCarInfoViewModel() { AutoMoldCode = quotereqCarInfo.auto_model_code ?? "", IsNewCar = quotereqCarInfo.is_newcar ?? 2, NegotiatePrice = quotereqCarInfo.co_real_value ?? 0, IsPublic = quotereqCarInfo.is_public ?? 0, CarUsedType = quotereqCarInfo.car_used_type ?? 0, AutoMoldCodeSource = quotereqCarInfo.auto_model_code_source ?? -1, DriveLicenseTypeName = quotereqCarInfo.drivlicense_cartype_name ?? "", DriveLicenseTypeValue = quotereqCarInfo.drivlicense_cartype_value ?? "", SeatUpdated = (quotereqCarInfo.seatflag ?? -1).ToString(), RequestActualDiscounts = (quotereqCarInfo.ActualDiscounts ?? 0).ToString(), RequestIsPaFloorPrice = (quotereqCarInfo.IsPaFloorPrice ?? 0).ToString(), DriverCard = quotereqCarInfo.DriverCard ?? "", DriverCardType = quotereqCarInfo.DriverCardType ?? "", }; //addby20180915继续拼装viewModel.ReqInfo对象,这是新增的折扣率的对象 if (quotereqCarInfo != null) { List <DiscountViewModel> dclist = new List <DiscountViewModel>(); DiscountViewModel dc; Dictionary <int, decimal> dictionary = new Dictionary <int, decimal>(); dictionary = quotereqCarInfo.actualdiscounts_ratio.FromJson <Dictionary <int, decimal> >(); if (dictionary != null) { foreach (var item in dictionary) { dc = new DiscountViewModel() { Source = SourceGroupAlgorithm.GetNewSource(item.Key), AD = item.Value, CR = 0, SR = 0, TRCR = "" }; //平安的特殊处理,取单独的字段 if (item.Key == 0) { dc.CR = quotereqCarInfo.ChannelRate ?? 0; dc.SR = quotereqCarInfo.SubmitRate ?? 0; dc.TRCR = quotereqCarInfo.TrCausesWhy ?? ""; } dclist.Add(dc); } } my.ReqInfo.RequestDiscount = dclist; } } else { my.IsPublic = 0; my.CoRealValue = 0; my.IsLoans = -1; my.TransferDate = "-1"; my.ReqInfo = new QuoteReqCarInfoViewModel() { AutoMoldCode = "", IsNewCar = 2, NegotiatePrice = 0, IsPublic = 0, CarUsedType = 0, AutoMoldCodeSource = -1, DriveLicenseTypeName = "", DriveLicenseTypeValue = "", SeatUpdated = "-1", RequestActualDiscounts = "0", RequestIsPaFloorPrice = "0", DriverCard = "", DriverCardType = "", RequestDiscount = new List <DiscountViewModel>() }; } return(my); }
public MyBaoJiaViewModel SetBaseInfo(MyBaoJiaViewModel my, bx_userinfo userInfo) { my.Holder = new Holder { HolderName = userInfo.HolderName ?? string.Empty, HolderIdType = userInfo.HolderIdType.HasValue ? userInfo.HolderIdType.Value : 0, HolderIdCard = userInfo.HolderIdCard ?? string.Empty, HolderMobile = userInfo.HolderMobile ?? string.Empty, HolderAddress = userInfo.HolderAddress ?? string.Empty, HolderEmail = userInfo.HolderEmail ?? string.Empty }; my.CarOwnerPerson = new RelationPerson { Address = userInfo.OwnerCertiAddress ?? string.Empty, Email = userInfo.Email ?? string.Empty, IdCard = userInfo.IdCard ?? string.Empty, IdType = userInfo.OwnerIdCardType, Mobile = userInfo.Mobile ?? string.Empty, Name = userInfo.LicenseOwner ?? string.Empty, Sex = userInfo.OwnerSex ?? 1, Authority = userInfo.OwnerIssuer ?? string.Empty, Birthday = string.IsNullOrEmpty(userInfo.OwnerBirthday) ? "" : Convert.ToDateTime(userInfo.OwnerBirthday).Date == DateTime.MinValue.Date ? "" : userInfo.OwnerBirthday, CertiEndDate = string.IsNullOrEmpty(userInfo.OwnerCertiEnddate) ? "" : Convert.ToDateTime(userInfo.OwnerCertiEnddate).Date == DateTime.MinValue.Date ? "" : userInfo.OwnerCertiEnddate, CertiStartDate = string.IsNullOrEmpty(userInfo.OwnerCertiStartdate) ? "" : Convert.ToDateTime(userInfo.OwnerCertiStartdate).Date == DateTime.MinValue.Date ? "" : userInfo.OwnerCertiStartdate, Nation = userInfo.OwnerNation ?? string.Empty }; my.HolderPerson = new RelationPerson() { Address = userInfo.HolderAddress ?? string.Empty, Email = string.IsNullOrWhiteSpace(userInfo.HolderEmail) ? my.CarOwnerPerson.Email : userInfo.HolderEmail, IdCard = userInfo.HolderIdCard ?? string.Empty, IdType = userInfo.HolderIdType ?? 0, Mobile = userInfo.HolderMobile ?? string.Empty, Name = userInfo.HolderName ?? string.Empty, Sex = userInfo.HolderSex ?? 1, Authority = userInfo.HolderIssuer ?? string.Empty, Birthday = string.IsNullOrEmpty(userInfo.HolderBirthday) ? "" : Convert.ToDateTime(userInfo.HolderBirthday).Date == DateTime.MinValue.Date ? "" : userInfo.HolderBirthday, CertiEndDate = string.IsNullOrEmpty(userInfo.HolderCertiEnddate) ? "" : Convert.ToDateTime(userInfo.HolderCertiEnddate).Date == DateTime.MinValue.Date ? "" : userInfo.HolderCertiEnddate, CertiStartDate = string.IsNullOrEmpty(userInfo.HolderCertiStartdate) ? "" : Convert.ToDateTime(userInfo.HolderCertiStartdate).Date == DateTime.MinValue.Date ? "" : userInfo.HolderCertiStartdate, Nation = userInfo.HolderNation ?? string.Empty }; my.InsuredPerson = new RelationPerson { Address = userInfo.InsuredAddress ?? string.Empty, Email = string.IsNullOrWhiteSpace(userInfo.InsuredEmail) ? my.CarOwnerPerson.Email : userInfo.InsuredEmail, IdCard = userInfo.InsuredIdCard ?? string.Empty, IdType = userInfo.InsuredIdType ?? 0, Mobile = userInfo.InsuredMobile ?? string.Empty, Name = userInfo.InsuredName ?? string.Empty, Sex = userInfo.InsuredSex ?? 1, Authority = userInfo.InsuredIssuer ?? string.Empty, Birthday = string.IsNullOrEmpty(userInfo.InsuredBirthday) ? "" : Convert.ToDateTime(userInfo.InsuredBirthday).Date == DateTime.MinValue.Date ? "" : userInfo.InsuredBirthday, CertiEndDate = string.IsNullOrEmpty(userInfo.InsuredCertiEnddate) ? "" : Convert.ToDateTime(userInfo.InsuredCertiEnddate).Date == DateTime.MinValue.Date ? "" : userInfo.InsuredCertiEnddate, CertiStartDate = string.IsNullOrEmpty(userInfo.InsuredCertiStartdate) ? "" : Convert.ToDateTime(userInfo.InsuredCertiStartdate).Date == DateTime.MinValue.Date ? "" : userInfo.InsuredCertiStartdate, Nation = userInfo.InsuredNation ?? string.Empty }; my.SubmitGroup = userInfo.Source.HasValue ? (userInfo.Source.Value > 0 ? userInfo.Source.Value : 0) : 0;//核保类型 my.CurOpenId = userInfo.OpenId; my.CurAgent = userInfo.Agent; my.MoldName = !string.IsNullOrEmpty(userInfo.MoldName) ? userInfo.MoldName : string.Empty; my.UserName = !string.IsNullOrEmpty(userInfo.UserName) ? userInfo.UserName : string.Empty; my.LicenseOwner = !string.IsNullOrEmpty(userInfo.LicenseOwner) ? userInfo.LicenseOwner : string.Empty; my.Buid = userInfo.Id; my.RegisterDate = !string.IsNullOrEmpty(userInfo.RegisterDate) ? userInfo.RegisterDate : string.Empty; //InsuredName和PostedName是一个字段,被保险人姓名 my.InsuredName = !string.IsNullOrEmpty(userInfo.InsuredName) ? userInfo.InsuredName : string.Empty; my.PostedName = !string.IsNullOrEmpty(userInfo.InsuredName) ? userInfo.InsuredName : string.Empty; //被保险人电话 my.InsuredMobile = !string.IsNullOrEmpty(userInfo.InsuredMobile) ? userInfo.InsuredMobile : string.Empty; //被保险人地址 my.InsuredAddress = !string.IsNullOrEmpty(userInfo.InsuredAddress) ? userInfo.InsuredAddress : string.Empty; //被保险人证件类型 my.InsuredIdType = userInfo.InsuredIdType.HasValue ? userInfo.InsuredIdType.Value : 0; //车主证件类型 my.IdType = userInfo.OwnerIdCardType;//_quoteResultCarinfoRepository.GetOwnerIdType(userInfo.Id); my.IdCard = !string.IsNullOrEmpty(userInfo.IdCard) ? userInfo.IdCard : string.Empty; //my.IdType = userInfo.InsuredIdType.HasValue ? userInfo.InsuredIdType.Value : 0; my.CredentislasNum = !string.IsNullOrEmpty(userInfo.IdCard) ? userInfo.IdCard : string.Empty; my.InsuredIdCard = !string.IsNullOrEmpty(userInfo.InsuredIdCard) ? userInfo.InsuredIdCard : string.Empty; my.CityCode = !string.IsNullOrEmpty(userInfo.CityCode) ? userInfo.CityCode : string.Empty; my.EngineNo = !string.IsNullOrEmpty(userInfo.EngineNo) ? userInfo.EngineNo : string.Empty; my.CarVin = !string.IsNullOrEmpty(userInfo.CarVIN) ? userInfo.CarVIN : string.Empty; //获取电子保单的邮箱地址 //my.Email = !string.IsNullOrEmpty(userInfo.Email) ? userInfo.Email : string.Empty; my.Email = !string.IsNullOrEmpty(userInfo.InsuredEmail) ? userInfo.InsuredEmail : string.Empty; my.Email = !string.IsNullOrEmpty(my.Email) ? my.Email : userInfo.Email; my.QuoteGroup = userInfo.IsSingleSubmit.HasValue ? userInfo.IsSingleSubmit.Value : 0; //报价类型 my.HasBaojia = my.QuoteGroup == 0 ? 0 : 1; if (my.QuoteGroup > 0) //(userinfo.QuoteStatus > -1) { my.HasBaojia = 1; //是否报过价 my.QuoteTime = userInfo.UpdateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } else { my.HasBaojia = 0; my.QuoteTime = ""; } if (string.IsNullOrWhiteSpace(my.QuoteTime)) { my.IsTheDay = 2; } else { my.IsTheDay = Convert.ToDateTime(my.QuoteTime).ToShortDateString() == DateTime.Now.ToShortDateString() ? 1 : 2; } my.SixDigitsAfterIdCard = userInfo.SixDigitsAfterIdCard ?? ""; return(my); }
public MyBaoJiaViewModel SetPrecisePriceItem(MyBaoJiaViewModel my, bx_userinfo userinfo, GetMyBjdDetailRequest request, List <bx_quoteresult_carinfo> quoteresultCarinfo, int reqseatcount) { var sourceList = _setPrecisePriceItem.FindSource(userinfo, request); //获取图片bx_picture List <bx_picture> picList = _pictureRepository.GetAllList(o => o.b_uid == userinfo.Id); //报价单资源对象 bx_savequote sq = _saveQuoteRepository.GetSavequoteByBuid(userinfo.Id); List <bx_quoteresult> qrList = _quoteResultRepository.GetQuoteResultList(userinfo.Id); List <bx_submit_info> siList = _submitInfoRepository.GetSubmitInfoList(userinfo.Id); List <bx_ywxdetail> ywxList = _ywxdetailRepository.GetList(userinfo.Id); //渠道列表 List <AgentConfigNameModel> agentChannelList = new List <AgentConfigNameModel>(); if (siList.Any()) { agentChannelList = _agentConfigRepository.FindListById(siList.Select(l => l.channel_id).Join(",")); } //图片url List <IsUploadImg> isUploadImg = new List <IsUploadImg>(); //报价信息模型,包括险种和报价 List <MyPrecisePriceItemViewModel> listquoteTotal = new List <MyPrecisePriceItemViewModel>(); var hebaodianweis = _hebaoDianweiRepository.FindList(userinfo.Id, SourceGroupAlgorithm.GetOldSources(sourceList.ToArray())); if (sourceList.Any() && userinfo.QuoteStatus > -1) { foreach (int itk in sourceList) { //20160905修改source1248=>0123,传入的新数据转换 var oit = SourceGroupAlgorithm.GetOldSource(itk);//获取到旧的source值 var submit = siList.FirstOrDefault(i => i.source == oit); var qr = qrList.FirstOrDefault(i => i.Source == oit); var jy = ywxList.Where(i => i.source == oit).ToList(); if (oit == 3) { if (!string.IsNullOrEmpty(request.NewRate) && qr != null) { qr.NewRate = decimal.Parse(request.NewRate); _quoteResultRepository.Update(qr); } else if (string.IsNullOrEmpty(request.NewRate) && qr != null && qr.NewRate != 0 && qr.NewRate != null) { request.NewRate = qr.NewRate.ToString(); } if (!string.IsNullOrEmpty(request.NewRate)) { my.NewRate = double.Parse(request.NewRate).ToString("#0.00000"); } } var model = ConvertToViewModelNew(oit, sq, qr, submit, userinfo.QuoteStatus.Value, agentChannelList, userinfo.CarVIN, jy, request.NewRate); var hebaodianwei = hebaodianweis.FirstOrDefault(heb => heb.source == oit); if (hebaodianwei != null && my.IsShowCalc == 0) { model.BizSysRate = hebaodianwei.system_biz_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_biz_rate.Value) : 0; model.ForceSysRate = hebaodianwei.system_force_rate.HasValue ? Convert.ToDecimal(hebaodianwei.system_force_rate.Value) : 0; //优惠费率 model.BenefitRate = hebaodianwei.agent_id == hebaodianwei.parent_agent_id ? Convert.ToDecimal(hebaodianwei.zhike_biz_rate.Value) : Convert.ToDecimal(hebaodianwei.agent_biz_rate.Value); } var qcinfo = quoteresultCarinfo.FirstOrDefault(l => l.source == oit); if (qcinfo != null) { model.CarUsedType = qcinfo.car_used_type ?? 0; model.SeatCount = qcinfo.seat_count ?? 0;//座位数赋值 } if (model.SeatCount == 0) { //如果报价结果没拿到座位数,将请求的赋值进去 model.SeatCount = reqseatcount; } model.JingSuanKouJing = submit != null ? (submit.RbJSKJ ?? "") : ""; listquoteTotal.Add(model); //拼装上传的图片模型 if (picList.Any()) { bx_picture picture = picList.FirstOrDefault(l => l.source == oit); if (picture != null && picture.id != 0) { IsUploadImg newmodel = new IsUploadImg() { IsUpload = 1, Source = itk }; isUploadImg.Add(newmodel); } } } my.PrecisePriceItem = listquoteTotal; my.IsUploadImg = isUploadImg; } else { my.PrecisePriceItem = new List <MyPrecisePriceItemViewModel>(); } return(my); }