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 #2
0
        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);
        }