コード例 #1
0
        public List <UrlAndType> GetPictures(long buid, long source)
        {
            int        oldsource = SourceGroupAlgorithm.GetOldSource(source);
            bx_picture picture   = _pictureRepository.FirstOrDefault(o => o.b_uid.Value == buid && o.source == oldsource);

            if (picture == null)
            {
                return(new List <UrlAndType>());
            }
            try
            {
                if (string.IsNullOrEmpty(picture.picsJson))
                {
                    return(new List <UrlAndType>());
                }
                var    imgs         = picture.picsJson.FromJson <List <UrlAndType> >();
                string uploadImgUrl = ConfigurationManager.AppSettings["ImageServer"];
                imgs.ForEach(i => i.Url = (i.Url.Contains(uploadImgUrl) ? i.Url : uploadImgUrl + i.Url));
                return(imgs);
            }
            catch
            {
                logInfo.Info("bx_picture中picsJson的格式不正确,buid为" + buid);
            }

            return(null);
        }
コード例 #2
0
        public BaseViewModel AddMultiple(AddMultipleInput input)
        {
            BaseViewModel viewModel = new BaseViewModel();

            try
            {
                //soucr转换
                int sourceold = SourceGroupAlgorithm.GetOldSource(input.Source);
                //判断list是否4种类型都有
                List <UrlAndType> urlType = input.UrlList;
                //if (urlType.Count < targetType.Length)
                //{
                //    return BaseViewModel.GetBaseViewModel(-10000, "每种照片至少传一张才可提交");
                //}
                //去掉类型限制
                //var acutalType = urlType.Select(o => o.Type).Distinct().ToArray();
                //if (!CommonHelper.ArrayCompare2(targetType, acutalType))
                //{
                //    return BaseViewModel.GetBaseViewModel(-10000, "缺少图片类型");
                //}

                //

                //检查buid的合法性
                if (!_userInfoRepository.IsExist(o => o.Id == input.BuId))
                {
                    return(BaseViewModel.GetBaseViewModel(-10000, "buid不存在"));
                }

                var picsJson = input.UrlList.ToJson();

                bx_picture pic = _pictureRepository.FirstOrDefault(o => o.b_uid == input.BuId && o.source == sourceold);
                if (pic == null)
                {
                    //不存在是插入
                    return(AddPicture(input.BuId, picsJson, sourceold));
                }
                else if (pic.state == 4)
                {//status=4 图片上传中不允许修改
                    return(BaseViewModel.GetBaseViewModel(-10002, "图片上传中不允许修改"));
                }
                else
                {//biud=>bx_picture存在 状态  !=4  直接更新
                    pic.picsJson    = picsJson;
                    pic.state       = 3;
                    pic.update_time = DateTime.Now;
                    pic.source      = sourceold;
                    return(UpdatePicture(pic));
                }
            }
            catch (Exception ex)
            {
                viewModel.BusinessStatus = -100003;
                logError.Info("上传图片发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException);
            }
            return(viewModel);
        }
コード例 #3
0
 private BaseViewModel UpdatePicture(bx_picture picture)
 {
     _pictureRepository.Update(picture);
     if (_pictureRepository.SaveChanges() > 0)
     {
         //调用中心的方法
         return(AddSuccessSendMsg(picture.b_uid.Value, picture.source.Value));
     }
     else
     {
         return(BaseViewModel.GetBaseViewModel(-10003, "添加失败"));
     }
 }
コード例 #4
0
        public List <IsUploadImg> IsUploadImg(long buid)
        {
            List <IsUploadImg> isUploadImg = new List <IsUploadImg>();
            bx_userinfo        userinfo    = _userInfoRepository.FindByBuid(buid);

            if (userinfo == null)
            {
                return(new List <IsUploadImg>());
            }
            if (!userinfo.IsSingleSubmit.HasValue)
            {
                return(new List <IsUploadImg>());
            }
            //获取图片bx_picture
            List <bx_picture> picList = _pictureRepository.GetAllList(o => o.b_uid == buid);
            //获取报了哪些保司
            List <long> sourceList = SourceGroupAlgorithm.ParseSource(userinfo.IsSingleSubmit.Value);

            if (sourceList.Any() && picList.Any())
            {
                foreach (int itk in sourceList)
                {
                    var oit = SourceGroupAlgorithm.GetOldSource(itk);//获取到旧的source值
                    //拼装上传的图片模型
                    bx_picture model = picList.FirstOrDefault(l => l.source == oit);
                    if (model != null && model.id != 0 && model.state == 5)
                    {
                        IsUploadImg newmodel = new IsUploadImg()
                        {
                            IsUpload = 1,//已上传
                            Source   = itk
                        };
                        isUploadImg.Add(newmodel);
                    }
                    else
                    {
                        IsUploadImg newmodel = new IsUploadImg()
                        {
                            IsUpload = 0,//未上传
                            Source   = itk
                        };
                        isUploadImg.Add(newmodel);
                    }
                }
            }
            return(isUploadImg);
        }
コード例 #5
0
        public int IsUploadImg(long buid, long source)
        {
            int        oldsource = SourceGroupAlgorithm.GetOldSource(source);
            bx_picture picture   = _pictureRepository.FirstOrDefault(o => o.b_uid.Value == buid && o.source == oldsource);

            if (picture == null)
            {
                return(0);
            }
            if (picture.state == 0)
            {
                return(0);
            }
            else
            {
                return(1);
            }
        }
コード例 #6
0
        /// <summary>
        /// 添加照片
        /// </summary>
        /// <param name="buId"></param>
        /// <param name="picsJson"></param>
        /// <returns></returns>
        private BaseViewModel AddPicture(long buId, string picsJson, int source)
        {
            bx_picture picture = new bx_picture
            {
                b_uid       = buId,
                picsJson    = picsJson,
                state       = 3,
                create_time = DateTime.Now,
                update_time = DateTime.Now,
                source      = source
            };

            _pictureRepository.Insert(picture);
            if (_pictureRepository.SaveChanges() > 0)
            {
                //调用中心的方法
                return(AddSuccessSendMsg(buId, source));
            }
            else
            {
                return(BaseViewModel.GetBaseViewModel(-10002, "添加失败"));
            }
        }
        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);
        }