Beispiel #1
0
        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 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());
        }
Beispiel #3
0
        public MyBaoJiaViewModel GetMyBjdDetail(GetMyBjdDetailRequest request, IEnumerable <KeyValuePair <string, string> > pairs)
        {
            DateTime    date1    = DateTime.Now;
            bx_userinfo userinfo = _userInfoRepository.FindByBuid(request.Buid);
            //校验
            var my = _checkRequestService.CheckRequest(userinfo, request);

            if (my.BusinessStatus != 1)
            {
                return(my);
            }
            my.BusinessStatus = 1;
            //获取修改时间
            my.UpdateTime = userinfo.LatestQuoteTime.HasValue ? userinfo.LatestQuoteTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";

            //获取在该报价单在预约单中记录
            my = _setOrderService.SetOrder(my, userinfo);

            //从userinfo获取关系人 和一些其他配置
            my = _setBaseInfoService.SetBaseInfo(my, userinfo);
            List <bx_quoteresult_carinfo> quoteresultCarinfo;

            //获取车辆信息bx_quoteresult_carinfo
            my = _setCarInfoService.SetCarInfo(my, userinfo, out quoteresultCarinfo);

            //取商业险和交强险开始时间
            string postForceStartDate;//交强险起始时间
            string postBizStartDate;

            postForceStartDate = _getDateService.GetDate(userinfo, out postBizStartDate);
            //请求报价的信息
            my = _setQuoteReqService.SetQuoteReq(my, userinfo, ref postBizStartDate, ref postForceStartDate);
            //给交强商业起始时间、到期时间赋值
            my = _setDateService.SetDate(my, userinfo, postBizStartDate, postForceStartDate);

            my = _setPrecisePriceItemService.SetPrecisePriceItem(my, userinfo, request, quoteresultCarinfo, my.SeatCount ?? 0);

            //获取出险记录
            my = _setClaimsService.SetClaims(my, request, userinfo);
            //获取优惠活动
            my = _setActivitiesService.SetActivities(my, request);
            //获取图片
            my.Images = _imagesRepository.FindByBuid(userinfo.Id);
            //是否是临时被保险人
            my.IsTempInsured = GetTempInsured(userinfo.Id);
            //赋值代理人信息,并初始化费率 展示费率
            my                   = _setAgentService.SetAgent(my, userinfo, request);
            my.QuoteTime         = 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") : "";
            if (request.ShowCarProperties <= 0)
            {
                my.IsLoans      = null;
                my.TransferDate = null;
            }
            return(my);
        }
Beispiel #4
0
        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 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);
 }
Beispiel #6
0
        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);
        }
Beispiel #8
0
        public List <long> FindSource(bx_userinfo userInfo, GetMyBjdDetailRequest request)
        {
            List <long> sourceInt  = _agentConfigRepository.FindSource(request.Agent);
            var         sourceList = new List <long>();

            if (request.Source != -1)
            {
                sourceList.Add(request.Source);
            }
            else
            {
                if (userInfo.IsSingleSubmit.HasValue)
                {
                    // 获取到记录用到的渠道列表
                    sourceList = SourceGroupAlgorithm.GetSource(sourceInt, userInfo.IsSingleSubmit.Value);
                }
            }
            return(sourceList);
        }
Beispiel #9
0
        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, 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);
        }
Beispiel #11
0
        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);
        }