public void Valid_savequoteIsNull_Return0() { #region 配置 Substitute ISaveQuoteRepository _saveQuoteRepository = Substitute.For <ISaveQuoteRepository>(); ISubmitInfoRepository _submitInfoRepository = Substitute.For <ISubmitInfoRepository>(); IQuoteResultRepository _quoteResultRepository = Substitute.For <IQuoteResultRepository>(); IUserInfoRepository _userInfoRepository = Substitute.For <IUserInfoRepository>(); _submitInfoRepository.GetSubmitInfo(Arg.Any <long>(), Arg.Any <int>()).Returns(x => new bx_submit_info()); _quoteResultRepository.GetQuoteResultByBuid(Arg.Any <long>(), Arg.Any <int>()).Returns(x => new bx_quoteresult()); _saveQuoteRepository.GetSavequoteByBuid(Arg.Any <long>()).Returns(x => null); UpdateBjdCheck updateBjdCheck = new UpdateBjdCheck(_saveQuoteRepository, _submitInfoRepository, _quoteResultRepository, _userInfoRepository); #endregion #region 操作 Arg bx_submit_info submitInfo = new bx_submit_info(); bx_quoteresult quoteresult = new bx_quoteresult(); bx_savequote savequote = new bx_savequote(); bx_userinfo userinfo = new bx_userinfo(); var result = updateBjdCheck.Valid(new CreateOrUpdateBjdInfoRequest()); #endregion #region 断言 Assert Assert.AreEqual(0, result.State); #endregion }
public bx_submit_info GetSubmitInfo(long buid, int source) { bx_submit_info submitInfo = new bx_submit_info(); try { submitInfo = DataContextFactory.GetDataContext().bx_submit_info.FirstOrDefault(x => x.b_uid == buid && x.source == source); } catch (Exception ex) { logError.Info("发生异常:" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } return(submitInfo); }
/// <summary> /// 返回核保信息的 定制化信息 /// </summary> /// <param name="submitInfo"></param> /// <returns></returns> public static SubmitInfoViewModel ConverToViewModelForCustom(this bx_submit_info submitInfo) { SubmitInfoViewModel vm = new SubmitInfoViewModel(); if (submitInfo.source != null) { vm.Item = new SubmitInfoDetail { BizNo = string.IsNullOrWhiteSpace(submitInfo.biz_tno) ? string.Empty : submitInfo.biz_tno, ForceNo = string.IsNullOrWhiteSpace(submitInfo.force_tno) ? string.Empty : submitInfo.force_tno, SubmitStatus = submitInfo.submit_status.HasValue?submitInfo.submit_status.Value:0, SubmitResult = string.IsNullOrWhiteSpace(submitInfo.quote_result_toc) ? string.Empty : submitInfo.quote_result_toc, Source = submitInfo.source.Value, BizRate = (double)(submitInfo.biz_rate.HasValue ? submitInfo.biz_rate.Value : 0), ForceRate = (double)(submitInfo.force_rate.HasValue ? submitInfo.force_rate.Value : 0), ChannelId = submitInfo.channel_id.HasValue ? submitInfo.channel_id.Value.ToString():"-1", } } ; return(vm); }
public Tuple <BaseResponse, bx_userinfo, bx_submit_info> SubmitInfoValidate(PostSubmitInfoRequest request) { BaseResponse response = new BaseResponse(); //校验:2userinfo存在记录 bx_userinfo userinfo = _userInfoRepository.FindByOpenIdAndLicense(request.CustKey, request.LicenseNo, request.ChildAgent.ToString(), request.RenewalCarType); if (userinfo == null) { response.Status = HttpStatusCode.NotAcceptable; return(Tuple.Create <BaseResponse, bx_userinfo, bx_submit_info>(response, null, null)); } //校验:3重新核保的source必须在之前报价+核保过(bx_userinfo的source和issinglesubmit包含这个值) //核保source集合 //long submitinfosource = userinfo.Source ?? 0; //报价source集合 long quotesource = userinfo.IsSingleSubmit ?? 0; //20181112把核保过的校验去掉,此处为沃云保双录报价做的处理 if (quotesource == 0) { response.Status = HttpStatusCode.NotAcceptable; return(Tuple.Create <BaseResponse, bx_userinfo, bx_submit_info>(response, null, null)); } if ((quotesource & request.Source) != request.Source) { response.Status = HttpStatusCode.NotAcceptable; return(Tuple.Create <BaseResponse, bx_userinfo, bx_submit_info>(response, null, null)); } //校验:4是否存在核保记录 bx_submit_info submitInfo = _submitInfoRepository.GetSubmitInfo(userinfo.Id, SourceGroupAlgorithm.GetOldSource(request.Source)); if (submitInfo == null) { response.Status = HttpStatusCode.NotAcceptable; } return(Tuple.Create <BaseResponse, bx_userinfo, bx_submit_info>(response, userinfo, submitInfo)); }
public bj_baodanxianzhong MapBaodanxianzhong(bj_baodanxinxi baodanxinxi, bx_quoteresult quoteresult, bx_savequote savequote, bx_submit_info submitInfo, List <bx_ywxdetail> jylist) { var baodanxianzhong = new bj_baodanxianzhong() { BaoDanXinXiId = baodanxinxi.Id, BizTotal = quoteresult.BizTotal.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BizTotal.Value : System.Math.Round((double)quoteresult.BizTotal.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BoLiBaoE = savequote.BoLi, BoLiBaoFei = quoteresult.BoLi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BoLi.Value : System.Math.Round((double)quoteresult.BoLi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianCheSun = quoteresult.BuJiMianCheSun.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianCheSun.Value : System.Math.Round((double)quoteresult.BuJiMianCheSun.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianDaoQiang = quoteresult.BuJiMianDaoQiang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianDaoQiang.Value : System.Math.Round((double)quoteresult.BuJiMianDaoQiang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianFuJian = quoteresult.BuJiMianFuJian.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianFuJian.Value : System.Math.Round((double)quoteresult.BuJiMianFuJian.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianRenYuan = quoteresult.BuJiMianRenYuan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianRenYuan.Value : System.Math.Round((double)quoteresult.BuJiMianRenYuan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSanZhe = quoteresult.BuJiMianSanZhe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSanZhe.Value : System.Math.Round((double)quoteresult.BuJiMianSanZhe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //2.1.5版本修改 新增6个字段 BuJiMianChengKe = quoteresult.BuJiMianChengKe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianChengKe.Value : System.Math.Round((double)quoteresult.BuJiMianChengKe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSiJi = quoteresult.BuJiMianSiJi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSiJi.Value : System.Math.Round((double)quoteresult.BuJiMianSiJi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianHuaHen = quoteresult.BuJiMianHuaHen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianHuaHen.Value : System.Math.Round((double)quoteresult.BuJiMianHuaHen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianSheShui = quoteresult.BuJiMianSheShui.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSheShui.Value : System.Math.Round((double)quoteresult.BuJiMianSheShui.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianZiRan = quoteresult.BuJiMianZiRan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianZiRan.Value : System.Math.Round((double)quoteresult.BuJiMianZiRan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, BuJiMianJingShenSunShi = quoteresult.BuJiMianJingShenSunShi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianJingShenSunShi.Value : System.Math.Round((double)quoteresult.BuJiMianJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanFangTeYueBaoE = savequote.HcSanFangTeYue.HasValue ? savequote.HcSanFangTeYue.Value : 0, SanFangTeYueBaoFei = quoteresult.HcSanFangTeYue.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcSanFangTeYue.Value : System.Math.Round((double)quoteresult.HcSanFangTeYue.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, JingShenSunShiBaoE = savequote.HcJingShenSunShi.HasValue ? savequote.HcJingShenSunShi.Value : 0, JingShenSunShiBaoFei = quoteresult.HcJingShenSunShi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcJingShenSunShi.Value : System.Math.Round((double)quoteresult.HcJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, HuoWuZeRenBaoE = savequote.HcHuoWuZeRen.HasValue ? savequote.HcHuoWuZeRen.Value : 0, HuoWuZeRenBaoFei = quoteresult.HcHuoWuZeRen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcHuoWuZeRen.Value : System.Math.Round((double)quoteresult.HcHuoWuZeRen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //设备损失 SheBeiSunShiBaoE = savequote.HcSheBeiSunshi.HasValue ? savequote.HcSheBeiSunshi.Value : 0, SheBeiSunShiBaoFei = quoteresult.HcSheBeiSunshi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcSheBeiSunshi.Value : System.Math.Round((double)quoteresult.HcSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //不计免设备损失 BuJiMianSheBeiSunShiBaoE = savequote.BuJiMianSheBeiSunshi.HasValue ? savequote.BuJiMianSheBeiSunshi.Value : 0, BuJiMianSheBeiSunShiBaoFei = quoteresult.BuJiMianSheBeiSunshi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.BuJiMianSheBeiSunshi.Value : System.Math.Round((double)quoteresult.BuJiMianSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, XiuLiChangBaoE = savequote.HcXiuLiChang, XiuLiChangBaoFei = quoteresult.HcXiuLiChang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcXiuLiChang.Value : System.Math.Round((double)quoteresult.HcXiuLiChang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, FeiYongBuChangBaoE = savequote.HcFeiYongBuChang, FeiYongBuChangBaoFei = quoteresult.HcFeiYongBuChang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HcFeiYongBuChang.Value : System.Math.Round((double)quoteresult.HcFeiYongBuChang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //2.1.5修改结束 //费用补偿天数 FybcDays = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0, CheDengBaoE = savequote.CheDeng, CheDengBaoFei = quoteresult.CheDeng.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.CheDeng.Value : System.Math.Round((double)quoteresult.CheDeng.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, ChengKeBaoE = savequote.ChengKe, ChengKeBaoFei = quoteresult.ChengKe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.ChengKe.Value : System.Math.Round((double)quoteresult.ChengKe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //CheSunBaoE = savequote.CheSun,//车损保额修改quoteresult CheSunBaoE = quoteresult.CheSunBE.HasValue ? quoteresult.CheSunBE.Value : 0, CheSunBaoFei = quoteresult.CheSun.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.CheSun.Value : System.Math.Round((double)quoteresult.CheSun.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, //DaoQiangBaoE = savequote.DaoQiang,//盗抢保额修改quoteresult DaoQiangBaoE = quoteresult.DaoQiangBE.HasValue ? quoteresult.DaoQiangBE : 0, DaoQiangBaoFei = quoteresult.DaoQiang.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.DaoQiang.Value : System.Math.Round((double)quoteresult.DaoQiang.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, ForceTotal = quoteresult.ForceTotal.HasValue ? quoteresult.ForceTotal.Value : 0, HuaHenBaoE = savequote.HuaHen, HuaHenBaoFei = quoteresult.HuaHen.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.HuaHen.Value : System.Math.Round((double)quoteresult.HuaHen.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanZheBaoE = savequote.SanZhe, SanZheBaoFei = quoteresult.SanZhe.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SanZhe.Value : System.Math.Round((double)quoteresult.SanZhe.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SheShuiBaoE = savequote.SheShui, SheShuiBaoFei = quoteresult.SheShui.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SheShui.Value : System.Math.Round((double)quoteresult.SheShui.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SiJiBaoE = savequote.SiJi, SiJiBaoFei = quoteresult.SiJi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SiJi.Value : System.Math.Round((double)quoteresult.SiJi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, Source = submitInfo.source, TaxTotal = quoteresult.TaxTotal.HasValue ? quoteresult.TaxTotal.Value : 0, //ZiRanBaoE = savequote.ZiRan,//自燃保额修改quoteresult ZiRanBaoE = quoteresult.ZiRanBE.HasValue ? quoteresult.ZiRanBE.Value : 0, ZiRanBaoFei = quoteresult.ZiRan.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.ZiRan.Value : System.Math.Round((double)quoteresult.ZiRan.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, SanZheJieJiaRiBaoE = savequote.SanZheJieJiaRi, SanZheJieJiaRiBaoFei = quoteresult.SanZheJieJiaRi.HasValue ? ((!quoteresult.NewRate.HasValue || quoteresult.NewRate == 0) ? quoteresult.SanZheJieJiaRi.Value : System.Math.Round((double)quoteresult.SanZheJieJiaRi.Value / (double)quoteresult.TotalRate * (double)quoteresult.NewRate, 2)) : 0, CreateTime = DateTime.Now, JiaoQiang = savequote.JiaoQiang }; #region 计免重新赋值,针对人保3.5代系统不计免赔合并展示的问题 if (baodanxianzhong.Source == 2 && baodanxianzhong.BuJiMianFuJian > 0) { //车损 if (savequote.BuJiMianCheSun > 0 && quoteresult.BuJiMianCheSun == 0) { baodanxianzhong.BuJiMianCheSun = -1; } //盗抢 if (savequote.BuJiMianDaoQiang > 0 && quoteresult.BuJiMianDaoQiang == 0) { baodanxianzhong.BuJiMianDaoQiang = -1; } //人员 if (savequote.BuJiMianRenYuan > 0 && quoteresult.BuJiMianRenYuan == 0) { baodanxianzhong.BuJiMianRenYuan = -1; } //三者 if (savequote.BuJiMianSanZhe > 0 && quoteresult.BuJiMianSanZhe == 0) { baodanxianzhong.BuJiMianSanZhe = -1; } //乘客 if (savequote.BuJiMianChengKe > 0 && quoteresult.BuJiMianChengKe == 0) { baodanxianzhong.BuJiMianChengKe = -1; } //司机 if (savequote.BuJiMianSiJi > 0 && quoteresult.BuJiMianSiJi == 0) { baodanxianzhong.BuJiMianSiJi = -1; } //划痕 if (savequote.BuJiMianHuaHen > 0 && quoteresult.BuJiMianHuaHen == 0) { baodanxianzhong.BuJiMianHuaHen = -1; } //涉水 if (savequote.BuJiMianSheShui > 0 && quoteresult.BuJiMianSheShui == 0) { baodanxianzhong.BuJiMianSheShui = -1; } //自燃 if (savequote.BuJiMianZiRan > 0 && quoteresult.BuJiMianZiRan == 0) { baodanxianzhong.BuJiMianZiRan = -1; } //精神损失 if (savequote.BuJiMianJingShenSunShi > 0 && quoteresult.BuJiMianJingShenSunShi == 0) { baodanxianzhong.BuJiMianJingShenSunShi = -1; } } //设备损失在上文已赋值,此处无需处理 //baodanxianzhong.BuJiMianSheBeiSunShiBaoE #endregion if (jylist != null && jylist.Any()) { jylist = jylist.Where(w => w.source == baodanxianzhong.Source).ToList(); if (jylist != null && jylist.Any()) { baodanxianzhong.JiaYiTotal = jylist.Sum(l => l.amount ?? 0); } } return(baodanxianzhong); }
public bj_baodanxinxi MapBaodanxinxi(CreateOrUpdateBjdInfoRequest request, bx_submit_info submitInfo, bx_quoteresult quoteresult, bx_savequote savequote, bx_userinfo userinfo, bx_quotereq_carinfo reqCarInfo, bx_preferential_activity activity) { var quotecarinfo = _quoteResultCarinfoRepository.Find(request.Buid, SourceGroupAlgorithm.GetOldSource(request.Source)); var lastinfo = _lastInfoRepository.GetByBuid(request.Buid); var listClaim = _userClaimRepository.FindList(request.Buid); int lossBizCount = listClaim.Where(n => n.pay_type == 0).ToList().Count; //商业出险次数 double?lossBizAmount = listClaim.Where(n => n.pay_type == 0).ToList().Sum(n => n.pay_amount); //商业出险金额 int lossForceCount = listClaim.Where(n => n.pay_type == 1).ToList().Count; //交强出险次数 double?lossForceAmount = listClaim.Where(n => n.pay_type == 1).ToList().Sum(n => n.pay_amount); //交强出险金额 var baodanxinxi = new bj_baodanxinxi { //BEGIN 2017-09-06新增字段 20170909L 当前后期修改中去掉了代理人信息(电话等) AgentId = request.ChildAgent == 0 ? int.Parse(userinfo.Agent) : request.ChildAgent, //END //BEGIN 2017-09-09新增字段 //activity_content = request.ActivityContent, activity_ids = activity.id.ToString(), //END // AgentId = int.Parse(userinfo.Agent), BizEndDate = lastinfo == null ? DateTime.MinValue : Convert.ToDateTime(lastinfo.last_business_end_date), //submitinfo.biz_end_time, BizNum = submitInfo.biz_tno, BizPrice = quoteresult.BizTotal.HasValue ? quoteresult.BizTotal.Value : 0, BizRate = double.Parse(submitInfo.biz_rate.HasValue ? submitInfo.biz_rate.Value.ToString() : "0"), BizStartDate = quoteresult.BizStartDate.HasValue ? quoteresult.BizStartDate.Value : (reqCarInfo.biz_start_date.HasValue?reqCarInfo.biz_start_date.Value:DateTime.MinValue),//submitInfo.biz_start_time, CarBrandModel = userinfo.MoldName, CarEngineNo = userinfo.EngineNo, CarLicense = userinfo.LicenseNo, CarOwner = userinfo.LicenseOwner, CarRegisterDate = string.IsNullOrEmpty(userinfo.RegisterDate) ? DateTime.MinValue : DateTime.Parse(userinfo.RegisterDate), CarVIN = userinfo.CarVIN, ChannelId = submitInfo.channel_id, CompanyId = submitInfo.source, CreateTime = DateTime.Now, ForceEndDate = lastinfo == null ? DateTime.MinValue : Convert.ToDateTime(lastinfo.last_end_date), //submitinfo.force_end_time, ForceStartDate = quoteresult.ForceStartDate.HasValue ? quoteresult.ForceStartDate.Value : (reqCarInfo.force_start_date.HasValue ? reqCarInfo.force_start_date.Value : DateTime.MinValue), //submitInfo.force_start_time, ForceNum = submitInfo.force_tno, ForcePrice = (quoteresult.ForceTotal.HasValue ? quoteresult.ForceTotal.Value : 0), ForceRate = double.Parse(submitInfo.force_rate.HasValue ? submitInfo.force_rate.Value.ToString() : "0"), InsuredName = userinfo.InsuredName, InsureIdNum = userinfo.InsuredIdCard, ManualBizRate = request.BizRate, ManualTaxRate = request.TaxRate, ManualForceRate = request.ForceRate, ObjectId = int.Parse(userinfo.Agent), ObjectType = 1, SubmitStatus = submitInfo.submit_status, TaxPrice = quoteresult.TaxTotal.HasValue ? quoteresult.TaxTotal.Value : 0, //新增的4个费率 NonClaimRate = (double)(quoteresult.RateFactor1.HasValue ? quoteresult.RateFactor1 : 0), MultiDiscountRate = (double)(quoteresult.RateFactor2.HasValue ? quoteresult.RateFactor2 : 0), AvgMileRate = (double)(quoteresult.RateFactor3.HasValue ? quoteresult.RateFactor3 : 0), RiskRate = (double)(quoteresult.RateFactor4.HasValue ? quoteresult.RateFactor4 : 0), //总费率系数 TotalRate = (quoteresult.NewRate.HasValue && quoteresult.NewRate != 0) ? quoteresult.NewRate.Value.ToString() : (quoteresult.TotalRate.HasValue ? quoteresult.TotalRate.Value.ToString() : "0"), //20170221新增增值税 AddValueTaxRate = request.AddValueTaxRate, //载客//+载质量 CarSeated = quotecarinfo != null ? (quotecarinfo.seat_count.HasValue ? quotecarinfo.seat_count.Value.ToString() : "0") : "0", //+ "/" + (quotecarinfo.car_equ_quality.HasValue ? quotecarinfo.car_equ_quality.Value.ToString() : "0") VehicleInfo = VehicleInfoMapper.VehicleInfoMethod(quotecarinfo), JqVehicleClaimType = quotecarinfo != null ? quotecarinfo.JqVehicleClaimType : "", SyVehicleClaimType = quotecarinfo != null ? quotecarinfo.SyVehicleClaimType : "", loss_biz_count = lossBizCount, loss_biz_amount = lossBizAmount.HasValue ? lossBizAmount.Value : 0, loss_force_count = lossForceCount, loss_force_amount = lossForceAmount.HasValue ? lossForceAmount.Value : 0 }; return(baodanxinxi); }
public Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> > GetModels(long buid, long groupspan) { List <bx_quote_history> listhistory = _quoteHistoryRepository.GetByBuid(buid, groupspan); List <int> listquote = new List <int>(); //未取到历史记录默认赋值为空 if (!listhistory.Any()) { return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(null, null, null, null, "", listquote)); } try { listquote = listhistory.Select(l => l.source.Value).ToList();//老的source值 //取到历史记录开始循环 bx_savequote savequote = new bx_savequote(); bx_quotereq_carinfo quotereq = new bx_quotereq_carinfo(); List <bx_quoteresult> listquoteresult = new List <bx_quoteresult>(); bx_quoteresult quoteresult = new bx_quoteresult(); List <bx_submit_info> listsubmitinfo = new List <bx_submit_info>(); bx_submit_info submitinfo = new bx_submit_info(); //险种信息 string strsavequote = listhistory.FirstOrDefault().savequote; savequote = !string.IsNullOrEmpty(strsavequote) && !strsavequote.Equals("null") ? strsavequote.FromJson <bx_savequote>() : null; //请求车辆信息 string strquotereq = listhistory.FirstOrDefault().quotereq; quotereq = !string.IsNullOrEmpty(strquotereq) && !strquotereq.Equals("null") ? strquotereq.FromJson <bx_quotereq_carinfo>() : null; //保费结果 string strquoteresult = string.Empty; //报价结果 string strsubmitinfo = string.Empty; foreach (var history in listhistory) { //保费结果 strquoteresult = history.quoteresult; if (!string.IsNullOrEmpty(strquoteresult) && !strquoteresult.Equals("null")) { quoteresult = new bx_quoteresult(); quoteresult = strquoteresult.FromJson <bx_quoteresult>(); if (quoteresult != null) { listquoteresult.Add(quoteresult); } } //报价结果 strsubmitinfo = history.submitinfo; if (!string.IsNullOrEmpty(strsubmitinfo) && !strsubmitinfo.Equals("null")) { submitinfo = new bx_submit_info(); submitinfo = strsubmitinfo.FromJson <bx_submit_info>(); if (submitinfo != null) { listsubmitinfo.Add(submitinfo); } } } string createtime = listhistory.FirstOrDefault().updatetime.HasValue ? listhistory.FirstOrDefault().updatetime.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(savequote, quotereq, listquoteresult, listsubmitinfo, createtime, listquote)); } catch (Exception ex) { logErr.Info(string.Format("报价历史解析出错,buid:{0};groupspan:{1};\n异常信息:{2}\n{3}", buid, groupspan, ex.StackTrace, ex.Message)); } return(new Tuple <bx_savequote, bx_quotereq_carinfo, List <bx_quoteresult>, List <bx_submit_info>, string, List <int> >(null, null, null, null, null, listquote)); }
public async Task <GetFloatingInfoResponse> GetFloatingInfo(GetFloatingInfoRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { GetFloatingInfoResponse response = new GetFloatingInfoResponse(); //校验:1基础校验 BaseResponse baseResponse = _validateService.Validate(request, pairs); if (baseResponse.Status == HttpStatusCode.Forbidden) { response.Status = HttpStatusCode.Forbidden; return(response); } //校验:2报价基础信息 UserInfoValidateRequest validateRequest = new UserInfoValidateRequest() { LicenseNo = request.LicenseNo, CustKey = request.CustKey, ChildAgent = request.ChildAgent == 0 ? request.Agent : request.ChildAgent, RenewalCarType = request.RenewalCarType }; //校验2 var validateResult = _userInfoValidateService.UserInfoValidate(validateRequest); if (validateResult.Item1.Status == HttpStatusCode.NotAcceptable) { response.Status = HttpStatusCode.NotAcceptable; return(response); } //校验:4是否存在核保记录 bx_submit_info submitInfo = _submitInfoRepository.GetSubmitInfo(validateResult.Item2.Id, SourceGroupAlgorithm.GetOldSource(request.Source)); string baojiaCacheKey = CommonCacheKeyFactory.CreateKeyWithLicenseAndAgentAndCustKey(request.LicenseNo, request.Agent, request.CustKey + request.RenewalCarType); string notifyCacheKey = string.Format("{0}-gzd", baojiaCacheKey); //通知中心 var msgBody = new { B_Uid = validateResult.Item2.Id, Source = SourceGroupAlgorithm.GetOldSource(request.Source), BiztNo = submitInfo != null ? submitInfo.biz_tno : "", ForcetNo = submitInfo != null ? submitInfo.force_tno : "", NotifyCacheKey = notifyCacheKey }; //发送安心核保消息 try { string baojiaKey = string.Format("{0}-Informing", notifyCacheKey); CacheProvider.Remove(baojiaKey); var msgbody = _messageCenter.SendToMessageCenter(msgBody.ToJson(), ConfigurationManager.AppSettings["MessageCenter"], ConfigurationManager.AppSettings["bxAnXinGaoZhi"]); var cacheKey = CacheProvider.Get <string>(baojiaKey); if (cacheKey == null) { for (int i = 0; i < 180; i++) { cacheKey = CacheProvider.Get <string>(baojiaKey); if (cacheKey != null) { break; } else { await Task.Delay(TimeSpan.FromSeconds(1)); } } } JSFloatingNotificationPrintListResponse jsonModel = new JSFloatingNotificationPrintListResponse(); if (!string.IsNullOrEmpty(cacheKey)) { jsonModel = cacheKey.FromJson <JSFloatingNotificationPrintListResponse>(); } response.JSFloatingNotificationPrintList = jsonModel.JSFloatingNotificationPrintListResponseMain; } catch (MessageException exception) { response.Status = HttpStatusCode.ExpectationFailed; response.ErrMsg = exception.Message; return(response); } return(response); }
public static OrderDetailResponse ConverToViewModel(this OrderCacheResponse orderModel) { OrderDetailResponse orderDetail = new OrderDetailResponse(); #region 实例化 //新实例start var carOrder = new CarOrder(); var userInfo = new UserInfo(); var claimDetails = new List <ClaimDetail>(); var precisePrice = new PrecisePrice(); //新实例end //原有实例start bx_car_order bxCarOrder = orderModel.BxCarOrder; bx_userinfo bxUserInfo = orderModel.BxUserInfo; bx_quoteresult bxQuoteResult = orderModel.BxQuoteResult; bx_savequote bxSaveQuote = orderModel.BxSaveQuote; bx_submit_info bxSubmitInfo = orderModel.BxSubmitInfo; bx_lastinfo bxLastInfo = orderModel.BxLastInfo; bx_quoteresult_carinfo bxCarInfo = orderModel.BxCarInfo; List <bx_claim_detail> bxClaimDetails = orderModel.BxClaimDetails; InsuranceStartDate qrStartDate = orderModel.QrStartDate; //原有实例end #endregion #region CarOrder转换 if (bxCarOrder != null) { carOrder.AgentName = string.Empty; carOrder.AgentMobile = string.Empty; if (bxCarOrder.cur_agent.HasValue) { carOrder.Agent = bxCarOrder.cur_agent.Value; //调用代理人列表 IAgentRepository agentRepository = new AgentRepository(); var curAgent = agentRepository.GetAgent(bxCarOrder.cur_agent.Value); if (curAgent != null) { carOrder.AgentName = curAgent.AgentName; carOrder.AgentMobile = curAgent.Mobile; } } carOrder.OpenId = bxCarOrder.openid; carOrder.Mobile = bxCarOrder.mobile; carOrder.ContactsName = bxCarOrder.contacts_name; carOrder.OrderStatus = bxCarOrder.order_status.HasValue ? bxCarOrder.order_status.Value : 0; carOrder.GetOrderTime = bxCarOrder.GetOrderTime.ToString(); carOrder.CreateTime = bxCarOrder.create_time.ToString(); carOrder.OrderId = bxCarOrder.id; carOrder.Buid = bxCarOrder.buid.HasValue ? bxCarOrder.buid.Value : 0; carOrder.Source = bxCarOrder.source.HasValue ? bxCarOrder.source.Value : 0; carOrder.Source = SourceGroupAlgorithm.GetNewSource((int)carOrder.Source); carOrder.InsuredName = bxCarOrder.insured_name; carOrder.IdType = bxCarOrder.id_type.HasValue ? bxCarOrder.id_type.Value : 2; //默认空时,赋值个“其他” carOrder.IdNum = bxCarOrder.id_num; carOrder.IdImgFirst = bxCarOrder.id_img_firs; carOrder.IdImgSecond = bxCarOrder.id_img_secd; carOrder.ImageUrls = bxCarOrder.imageUrls; carOrder.ProvinceName = string.Empty; carOrder.CityName = string.Empty; carOrder.AreaName = string.Empty; carOrder.DistributionAddress = bxCarOrder.distribution_address; carOrder.DistributionName = bxCarOrder.distribution_name; carOrder.DistributionPhone = bxCarOrder.distribution_phone; carOrder.DistributionTime = bxCarOrder.distribution_time.HasValue ? bxCarOrder.distribution_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty; carOrder.InsurancePrice = bxCarOrder.insurance_price.HasValue ? (double)bxCarOrder.insurance_price.Value : 0; carOrder.CarriagePrice = bxCarOrder.carriage_price.HasValue ? (double)bxCarOrder.carriage_price.Value : 0; carOrder.TotalPrice = bxCarOrder.total_price.HasValue ? (double)bxCarOrder.total_price.Value : 0; carOrder.Receipt = bxCarOrder.receipt_title; carOrder.ReceiptHead = bxCarOrder.receipt_head.HasValue ? bxCarOrder.receipt_head.Value : 0; carOrder.PayType = bxCarOrder.pay_type.HasValue ? bxCarOrder.pay_type.Value : 0; carOrder.DistributionType = bxCarOrder.distribution_type.HasValue ? bxCarOrder.distribution_type.Value : 0; } #endregion #region UserInfo转换 if (bxUserInfo != null) { userInfo.LicenseNo = bxUserInfo.LicenseNo; userInfo.LicenseOwner = bxUserInfo.LicenseOwner; userInfo.IdType = bxUserInfo.OwnerIdCardType; //默认空时,赋值个“其他” userInfo.InsuredName = bxUserInfo.InsuredName; userInfo.InsuredMobile = bxUserInfo.InsuredMobile; userInfo.InsuredAddress = bxUserInfo.InsuredAddress; userInfo.InsuredIdType = bxUserInfo.InsuredIdType.HasValue ? bxUserInfo.InsuredIdType.Value : 6; //默认空时,赋值个“其他” userInfo.CredentislasNum = bxUserInfo.InsuredIdCard; userInfo.Email = bxUserInfo.Email; userInfo.CityCode = !string.IsNullOrEmpty(bxUserInfo.CityCode) ? int.Parse(bxUserInfo.CityCode) : 0; //CarUsedType如下 userInfo.EngineNo = bxUserInfo.EngineNo; userInfo.CarVin = bxUserInfo.CarVIN; //PurchasePrice如下 //SeatCount如下 userInfo.ModleName = bxUserInfo.MoldName; userInfo.RegisterDate = bxUserInfo.RegisterDate; //LastEndDate如下 //LastBusinessEndDdate如下 //ForceStartDate如下 //BizStartDate如下 //ClaimCount如下 } #endregion #region QuoteResultCarInfo转换 if (bxCarInfo != null) { userInfo.CarUsedType = bxCarInfo.car_used_type.HasValue ? bxCarInfo.car_used_type.Value : 0; userInfo.PurchasePrice = bxCarInfo.purchase_price.HasValue ? (double)bxCarInfo.purchase_price.Value : 0; userInfo.SeatCount = bxCarInfo.seat_count.HasValue ? bxCarInfo.seat_count.Value : 0; } #endregion #region ClaimDetails转换 if (bxClaimDetails != null) { userInfo.ClaimCount = bxClaimDetails.Count; var claim = new ClaimDetail(); var claimDetail = new bx_claim_detail(); for (int i = 0; i < userInfo.ClaimCount; i++) { claim = new ClaimDetail(); claimDetail = new bx_claim_detail(); claimDetail = bxClaimDetails[i]; claim.EndcaseTime = claimDetail.endcase_time.HasValue ? claimDetail.endcase_time.Value.ToString() : string.Empty; claim.LossTime = claimDetail.loss_time.HasValue ? claimDetail.loss_time.Value.ToString() : string.Empty; claim.PayAmount = claimDetail.pay_amount.HasValue ? claimDetail.pay_amount.Value : 0; claim.PayCompanyName = claimDetail.pay_company_name; claimDetails.Add(claim); } } #endregion #region SaveQuote、QuoteResult、SubmitInfo转换 if (bxSaveQuote != null) { bool isquoteresult = true; if (bxQuoteResult == null) { isquoteresult = false; bxQuoteResult = new bx_quoteresult(); } precisePrice.BizTotal = bxQuoteResult.BizTotal.HasValue ? bxQuoteResult.BizTotal.Value : 0; precisePrice.ForceTotal = bxQuoteResult.ForceTotal ?? 0; precisePrice.TaxTotal = bxQuoteResult.TaxTotal ?? 0; precisePrice.Source = bxQuoteResult.Source ?? 0; precisePrice.Source = SourceGroupAlgorithm.GetNewSource((int)precisePrice.Source); precisePrice.JiaoQiang = bxSaveQuote.JiaoQiang.HasValue ? bxSaveQuote.JiaoQiang.Value : 1; if (bxSubmitInfo != null) { precisePrice.QuoteStatus = bxSubmitInfo.quote_status.HasValue ? bxSubmitInfo.quote_status.Value : 0; precisePrice.QuoteResult = bxSubmitInfo.quote_result; precisePrice.SubmitStatus = bxSubmitInfo.submit_status.HasValue ? bxSubmitInfo.submit_status.Value : 0; precisePrice.SubmitResult = bxSubmitInfo.submit_result; precisePrice.BizTno = bxSubmitInfo.biz_tno; precisePrice.ForceTno = bxSubmitInfo.force_pno; precisePrice.BizSysRate = bxSubmitInfo.biz_rate.HasValue ? (double)bxSubmitInfo.biz_rate.Value : 0; precisePrice.ForceSysRate = bxSubmitInfo.force_rate.HasValue ? (double)bxSubmitInfo.force_rate.Value : 0; //BenefitRate } precisePrice.CheSun = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.CheSunBE.HasValue ? bxQuoteResult.CheSunBE.Value : 0) : (bxSaveQuote.CheSun.HasValue ? bxSaveQuote.CheSun.Value : 0), BaoFei = bxQuoteResult.CheSun.HasValue ? bxQuoteResult.CheSun.Value : 0 }; precisePrice.SanZhe = new XianZhongUnit { BaoE = bxSaveQuote.SanZhe.HasValue ? bxSaveQuote.SanZhe.Value : 0, BaoFei = bxQuoteResult.SanZhe.HasValue ? bxQuoteResult.SanZhe.Value : 0 }; precisePrice.DaoQiang = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.DaoQiangBE.HasValue ? bxQuoteResult.DaoQiangBE.Value : 0) : (bxSaveQuote.DaoQiang.HasValue ? bxSaveQuote.DaoQiang.Value : 0), BaoFei = bxQuoteResult.DaoQiang.HasValue ? bxQuoteResult.DaoQiang.Value : 0 }; precisePrice.SiJi = new XianZhongUnit { BaoE = bxSaveQuote.SiJi.HasValue ? bxSaveQuote.SiJi.Value : 0, BaoFei = bxQuoteResult.SiJi.HasValue ? bxQuoteResult.SiJi.Value : 0 }; precisePrice.ChengKe = new XianZhongUnit { BaoE = bxSaveQuote.ChengKe.HasValue ? bxSaveQuote.ChengKe.Value : 0, BaoFei = bxQuoteResult.ChengKe.HasValue ? bxQuoteResult.ChengKe.Value : 0 }; precisePrice.BoLi = new XianZhongUnit { BaoE = bxSaveQuote.BoLi.HasValue ? bxSaveQuote.BoLi.Value : 0, BaoFei = bxQuoteResult.BoLi.HasValue ? bxQuoteResult.BoLi.Value : 0 }; precisePrice.HuaHen = new XianZhongUnit { BaoE = bxSaveQuote.HuaHen.HasValue ? bxSaveQuote.HuaHen.Value : 0, BaoFei = bxQuoteResult.HuaHen.HasValue ? bxQuoteResult.HuaHen.Value : 0 }; precisePrice.BuJiMianCheSun = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianCheSun.HasValue ? bxSaveQuote.BuJiMianCheSun.Value : 0, BaoFei = bxQuoteResult.BuJiMianCheSun.HasValue ? bxQuoteResult.BuJiMianCheSun.Value : 0 }; precisePrice.BuJiMianSanZhe = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianSanZhe.HasValue ? bxSaveQuote.BuJiMianSanZhe.Value : 0, BaoFei = bxQuoteResult.BuJiMianSanZhe.HasValue ? bxQuoteResult.BuJiMianSanZhe.Value : 0 }; precisePrice.BuJiMianDaoQiang = new XianZhongUnit { BaoE = bxSaveQuote.BuJiMianDaoQiang.HasValue ? bxSaveQuote.BuJiMianDaoQiang.Value : 0, BaoFei = bxQuoteResult.BuJiMianDaoQiang.HasValue ? bxQuoteResult.BuJiMianDaoQiang.Value : 0 }; precisePrice.BuJiMianChengKe = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianChengKe.HasValue ? bxSaveQuote.BuJiMianChengKe.Value : 0, BaoFei = bxQuoteResult.BuJiMianChengKe.HasValue ? bxQuoteResult.BuJiMianChengKe.Value : 0 }; precisePrice.BuJiMianSiJi = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianSiJi.HasValue ? bxSaveQuote.BuJiMianSiJi.Value : 0, BaoFei = bxQuoteResult.BuJiMianSiJi.HasValue ? bxQuoteResult.BuJiMianSiJi.Value : 0 }; precisePrice.BuJiMianHuaHen = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianHuaHen.HasValue ? bxSaveQuote.BuJiMianHuaHen.Value : 0, BaoFei = bxQuoteResult.BuJiMianHuaHen.HasValue ? bxQuoteResult.BuJiMianHuaHen.Value : 0 }; precisePrice.BuJiMianSheShui = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianSheShui.HasValue ? bxSaveQuote.BuJiMianSheShui.Value : 0, BaoFei = bxQuoteResult.BuJiMianSheShui.HasValue ? bxQuoteResult.BuJiMianSheShui.Value : 0 }; precisePrice.BuJiMianZiRan = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianZiRan.HasValue ? bxSaveQuote.BuJiMianZiRan.Value : 0, BaoFei = bxQuoteResult.BuJiMianZiRan.HasValue ? bxQuoteResult.BuJiMianZiRan.Value : 0 }; precisePrice.BuJiMianJingShenSunShi = new XianZhongUnit() { BaoE = bxSaveQuote.BuJiMianJingShenSunShi.HasValue ? bxSaveQuote.BuJiMianJingShenSunShi.Value : 0, BaoFei = bxQuoteResult.BuJiMianJingShenSunShi.HasValue ? bxQuoteResult.BuJiMianJingShenSunShi.Value : 0 }; precisePrice.SheShui = new XianZhongUnit { BaoE = bxSaveQuote.SheShui.HasValue ? bxSaveQuote.SheShui.Value : 0, BaoFei = bxQuoteResult.SheShui.HasValue ? bxQuoteResult.SheShui.Value : 0 }; precisePrice.ZiRan = new XianZhongUnit { BaoE = isquoteresult ? (bxQuoteResult.ZiRanBE.HasValue ? bxQuoteResult.ZiRanBE.Value : 0) : (bxSaveQuote.ZiRan.HasValue ? bxSaveQuote.ZiRan.Value : 0), BaoFei = bxQuoteResult.ZiRan.HasValue ? bxQuoteResult.ZiRan.Value : 0 }; precisePrice.HcSheBeiSunshi = new XianZhongUnit { BaoE = bxSaveQuote.HcSheBeiSunshi.HasValue ? bxSaveQuote.HcSheBeiSunshi.Value : 0, BaoFei = bxQuoteResult.HcSheBeiSunshi.HasValue ? bxQuoteResult.HcSheBeiSunshi.Value : 0 }; precisePrice.HcHuoWuZeRen = new XianZhongUnit { BaoE = bxSaveQuote.HcHuoWuZeRen.HasValue ? bxSaveQuote.HcHuoWuZeRen.Value : 0, BaoFei = bxQuoteResult.HcHuoWuZeRen.HasValue ? bxQuoteResult.HcHuoWuZeRen.Value : 0 }; precisePrice.HcFeiYongBuChang = new XianZhongUnit { BaoE = bxSaveQuote.HcFeiYongBuChang.HasValue ? bxSaveQuote.HcFeiYongBuChang.Value : 0, BaoFei = bxQuoteResult.HcFeiYongBuChang.HasValue ? bxQuoteResult.HcFeiYongBuChang.Value : 0 }; precisePrice.HcJingShenSunShi = new XianZhongUnit { BaoE = bxSaveQuote.HcJingShenSunShi.HasValue ? bxSaveQuote.HcJingShenSunShi.Value : 0, BaoFei = bxQuoteResult.HcJingShenSunShi.HasValue ? bxQuoteResult.HcJingShenSunShi.Value : 0 }; precisePrice.HcSanFangTeYue = new XianZhongUnit { BaoE = bxSaveQuote.HcSanFangTeYue.HasValue ? bxSaveQuote.HcSanFangTeYue.Value : 0, BaoFei = bxQuoteResult.HcSanFangTeYue.HasValue ? bxQuoteResult.HcSanFangTeYue.Value : 0 }; precisePrice.HcXiuLiChang = new XianZhongUnit { BaoE = bxSaveQuote.HcXiuLiChang.HasValue ? bxSaveQuote.HcXiuLiChang.Value : 0, BaoFei = bxQuoteResult.HcXiuLiChang.HasValue ? bxQuoteResult.HcXiuLiChang.Value : 0 }; precisePrice.HcXiuLiChangType = bxSaveQuote.HcXiuLiChangType.HasValue ? bxSaveQuote.HcXiuLiChangType.Value.ToString() : "-1"; precisePrice.RateFactor1 = bxQuoteResult.RateFactor1.HasValue ? (double)bxQuoteResult.RateFactor1.Value : 0; precisePrice.RateFactor2 = bxQuoteResult.RateFactor2.HasValue ? (double)bxQuoteResult.RateFactor2.Value : 0; precisePrice.RateFactor3 = bxQuoteResult.RateFactor3.HasValue ? (double)bxQuoteResult.RateFactor3.Value : 0; precisePrice.RateFactor4 = bxQuoteResult.RateFactor4.HasValue ? (double)bxQuoteResult.RateFactor4.Value : 0; } #endregion #region LastInfo转换 if (bxLastInfo != null) { userInfo.LastEndDate = bxLastInfo.last_end_date; userInfo.LastBusinessEndDdate = bxLastInfo.last_business_end_date; } #endregion #region 保险起始时间 if (qrStartDate != null) { userInfo.ForceStartDate = qrStartDate.ForceStartDate.HasValue ? qrStartDate.ForceStartDate.Value.ToString() : string.Empty; userInfo.BizStartDate = qrStartDate.BizStartDate.HasValue ? qrStartDate.BizStartDate.Value.ToString() : string.Empty; } #endregion orderDetail.CarOrder = carOrder; orderDetail.ClaimDetail = claimDetails; orderDetail.PrecisePrice = precisePrice; orderDetail.UserInfo = userInfo; return(orderDetail); }
public async Task <BaseResponse> PostIndependentSubmit(PostIndependentSubmitRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { GetFloatingInfoResponse response = new GetFloatingInfoResponse(); //校验:1基础校验 BaseResponse baseResponse = _validateService.Validate(request, pairs); if (baseResponse.Status == HttpStatusCode.Forbidden) { response.Status = HttpStatusCode.Forbidden; return(response); } //校验:2报价基础信息 UserInfoValidateRequest validateRequest = new UserInfoValidateRequest() { LicenseNo = request.LicenseNo, CustKey = request.CustKey, ChildAgent = request.ChildAgent == 0 ? request.Agent : request.ChildAgent, RenewalCarType = request.RenewalCarType }; //校验2 var validateResult = _userInfoValidateService.UserInfoValidate(validateRequest); if (validateResult.Item1.Status == HttpStatusCode.NotAcceptable) { response.Status = HttpStatusCode.NotAcceptable; return(response); } //插库操作 try { bx_userinfo userinfo = validateResult.Item2; userinfo.Source = (userinfo.Source.Value | request.Source); #region 车主信息 if (!string.IsNullOrWhiteSpace(request.Mobile)) { userinfo.Mobile = request.Mobile; } if (!string.IsNullOrWhiteSpace(request.CarOwnersName)) { userinfo.LicenseOwner = request.CarOwnersName; } if (!string.IsNullOrWhiteSpace(request.IdCard)) { userinfo.IdCard = request.IdCard; } if (request.OwnerIdCardType >= 0) { userinfo.OwnerIdCardType = request.OwnerIdCardType; } #endregion #region 被保险人信息 if (!string.IsNullOrWhiteSpace(request.InsuredName)) { userinfo.InsuredName = request.InsuredName.Trim(); } if (!string.IsNullOrWhiteSpace(request.InsuredIdCard)) { userinfo.InsuredIdCard = request.InsuredIdCard.ToUpper(); //if (request.InsuredIdCard.IsValidIdCard()) //{ // request.InsuredIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.InsuredEmail)) { userinfo.InsuredEmail = request.InsuredEmail; } if (!string.IsNullOrWhiteSpace(request.InsuredMobile)) { userinfo.InsuredMobile = request.InsuredMobile.Trim(); } if (request.InsuredIdType >= 0) { userinfo.InsuredIdType = request.InsuredIdType; } userinfo.InsuredAddress = request.InsuredAddress; //userinfo.InsuredCertiStartdate = request.InsuredCertiStartdate; //userinfo.InsuredCertiEnddate = request.InsuredCertiEnddate; //userinfo.InsuredSex = request.InsuredSex; //userinfo.InsuredBirthday = request.InsuredBirthday; //userinfo.InsuredIssuer = request.InsuredAuthority; //userinfo.InsuredNation = request.InsuredNation; #endregion #region 投保人信息 if (!string.IsNullOrWhiteSpace(request.HolderEmail)) { userinfo.HolderEmail = request.HolderEmail; } if (!string.IsNullOrWhiteSpace(request.HolderName)) { userinfo.HolderName = request.HolderName.Trim(); } if (!string.IsNullOrWhiteSpace(request.HolderIdCard)) { userinfo.HolderIdCard = request.HolderIdCard.ToUpper(); //if (request.HolderIdCard.IsValidIdCard()) //{ // request.HolderIdType = 1; //} } if (!string.IsNullOrWhiteSpace(request.HolderMobile)) { userinfo.HolderMobile = request.HolderMobile.Trim(); } if (request.HolderIdType >= 0) { userinfo.HolderIdType = request.HolderIdType; } userinfo.HolderAddress = request.HolderAddress; //userinfo.HolderCertiStartdate = request.HolderCertiStartdate; //userinfo.HolderCertiEnddate = request.HolderCertiEnddate; //userinfo.HolderSex = request.HolderSex; //userinfo.HolderBirthday = request.HolderBirthday; //userinfo.HolderIssuer = request.HolderAuthority; //userinfo.HolderNation = request.HolderNation; #endregion _userInfoRepository.Update(userinfo); bx_submit_info submitinfo = _submitInfoRepository.GetSubmitInfo(validateResult.Item2.Id, SourceGroupAlgorithm.GetOldSource(request.Source)); bx_anxin_delivery oldData = _anxindeliveryRepository.Search(l => l.b_uid == validateResult.Item2.Id && l.status == 1).FirstOrDefault(); if (oldData != null && oldData.id != 0) { oldData.status = 0; oldData.updatetime = DateTime.Now; _anxindeliveryRepository.Update(oldData); } //先删除,再插入 bx_anxin_delivery model = new bx_anxin_delivery() { b_uid = validateResult.Item2.Id, signincnm = request.SignerName, //签收人姓名 signintel = request.SignerTel, //签收人手机号 sendorderaddr = request.SingerAddress, //签收人地址 zipcde = request.ZipCode, //邮政编码 sy_plytyp = request.BizPolicyType, //商业保单形式 sy_invtype = request.BizElcInvoice, //商业电子发票形式 sy_appno = submitinfo != null ? submitinfo.biz_tno : "", //request.BizNo,//商业投保单号 jq_invtype = request.ForceElcInvoice, //交强电子发票类型 jq_plytyp = request.ForcePolicyType, //交强投保单形式 jq_appno = submitinfo != null ? submitinfo.force_tno : "", //request.ForceNO,//交强投保单号 appvalidateno = request.ProductNo, //产品代码 status = 1, //删除状态标示 0标识删除 createtime = DateTime.Now, updatetime = DateTime.Now }; _anxindeliveryRepository.Insert(model); } catch (Exception ex) { } //实现 //清理缓存 string baojiaCacheKey = string.Empty; try { PostSubmitInfoRequest newrequest = new PostSubmitInfoRequest() { LicenseNo = request.LicenseNo, ChildAgent = request.ChildAgent == 0 ? request.Agent : request.ChildAgent, Agent = request.Agent, RenewalCarType = request.RenewalCarType, CustKey = request.CustKey, Source = request.Source }; baojiaCacheKey = _removeHeBaoKey.RemoveHeBao(newrequest); } catch (RedisOperateException exception) { response.Status = HttpStatusCode.ExpectationFailed; response.ErrMsg = exception.Message; return(response); } //通知中心 var msgBody = new { BUid = validateResult.Item2.Id, Source = SourceGroupAlgorithm.GetOldSource(request.Source), RedisKey = baojiaCacheKey, //20180509新增 PayFinishUrl = request.PayFinishUrl, PayCancelUrl = request.PayCancelUrl, BgRetUrl = string.IsNullOrWhiteSpace(request.BgRetUrl) ? "http://buc.91bihu.com/api/PayOut/GetAXPayBack" : request.BgRetUrl, PayErrorUrl = request.PayErrorUrl, Attach = request.Attach }; //发送安心核保消息 try { var msgbody = _messageCenter.SendToMessageCenter(msgBody.ToJson(), ConfigurationManager.AppSettings["MessageCenter"], ConfigurationManager.AppSettings["BxAnXinHeBao"]); } catch (MessageException exception) { response.Status = HttpStatusCode.ExpectationFailed; response.ErrMsg = exception.Message; return(response); } return(response); }
public BaseViewModel Validate(UploadMultipleImgRequest request) { BaseViewModel viewModel = new BaseViewModel(); #region 参数验证 bx_userinfo userinfo = new bx_userinfo(); if (request.BuId > 0) { //userinfo是否有值,buid是否正确 userinfo = _userInfoRepository.FindByBuid(request.BuId); } //modifybygpj20181205修改,不开放前端传buid了 else { //如果前端传子集代理Id,则用子集代理Id来查数据 request.Agent = request.ChildAgent > 0 ? request.ChildAgent : request.Agent; //参数有效性校验 if (string.IsNullOrWhiteSpace(request.LicenseNo) || string.IsNullOrWhiteSpace(request.CustKey) || request.Agent < 1) { return(BaseViewModel.GetBaseViewModel(-10000, "车牌号、CustKey、Agent不允许为空")); } //根据车牌、代理、custkey来取数据库userinfo userinfo = _userInfoRepository.FindByOpenIdAndLicense(request.CustKey, request.LicenseNo, request.Agent.ToString(), request.RenewalCarType); } //如果userinfo没记录,直接提示错误参数 if (userinfo == null || userinfo.Id == 0) { return(BaseViewModel.GetBaseViewModel(-10000, "参数错误,无法拿到请求的车辆信息")); } //给buid赋值 if (request.BuId == 0) { request.BuId = userinfo.Id; } int source = SourceGroupAlgorithm.GetOldSource(request.Source); //submitinfo是否有值 bx_submit_info submitInfo = _submitInfoRepository.GetSubmitInfo(request.BuId, source); if (submitInfo == null) { return(BaseViewModel.GetBaseViewModel(-10000, "未取到核保信息,请稍后再试")); } //是否需要上传图片 if (request.Source == 2) { if (string.IsNullOrEmpty(submitInfo.documentGroupId)) { return(BaseViewModel.GetBaseViewModel(-10000, "请确认是否需要上传类型范围内的证件资料")); } } else { if (string.IsNullOrEmpty(submitInfo.biz_tno) && string.IsNullOrEmpty(submitInfo.force_tno)) { return(BaseViewModel.GetBaseViewModel(-10000, "请确认是否需要上传类型范围内的证件资料")); } } //上传的图片最少1张 var dic = request.ListBaseContect;//JsonConvert.DeserializeObject<Dictionary<int, string>>(request.ListBaseContect); if (dic.Count == 0) { viewModel.BusinessStatus = -10000; viewModel.StatusMessage = "输入参数错误,ListBaseContect为空"; return(viewModel); } //不能超过11张上传图片//以前是8张的限制 else if (dic.Count > 11) { viewModel.BusinessStatus = -10000; viewModel.StatusMessage = "最多11张图片"; return(viewModel); } #endregion //校验上传次数 var timesValidate = _checkUploadImgTimes.ValidateTimes(request); if (timesValidate.BusinessStatus == -10013) { viewModel.BusinessStatus = -10013; viewModel.StatusMessage = timesValidate.StatusMessage; return(viewModel); } return(BaseViewModel.GetBaseViewModel(1, "校验成功")); }
public MyPrecisePriceItemViewModel ConvertToViewModelNew(int source, bx_savequote savequote, bx_quoteresult quoteresult, bx_submit_info submitInfo, int quoteStatus, List <AgentConfigNameModel> agentChannelList, string carVin, List <bx_ywxdetail> jiayi, string strRate = null) { double?newRate = null; if (!string.IsNullOrEmpty(strRate) && source == 3) { newRate = double.Parse(strRate); } if (savequote == null) { savequote = new bx_savequote(); } if (submitInfo == null) { submitInfo = new bx_submit_info(); } var isquoteresult = true; if (quoteresult == null) { isquoteresult = false; quoteresult = new bx_quoteresult(); } var model = new MyPrecisePriceItemViewModel() { BizRate = (double)(submitInfo.biz_rate.HasValue ? submitInfo.biz_rate.Value : 0), ForceRate = (double)(submitInfo.force_rate.HasValue ? submitInfo.force_rate.Value : 0), BizTotal = quoteresult.BizTotal.HasValue ? (newRate == null ? quoteresult.BizTotal.Value : System.Math.Round((double)quoteresult.BizTotal.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0, ForceTotal = quoteresult.ForceTotal ?? 0, TaxTotal = quoteresult.TaxTotal ?? 0, Source = SourceGroupAlgorithm.GetNewSource(source), QuoteStatus = submitInfo.quote_status.HasValue ? submitInfo.quote_status.Value : 0, QuoteResult = !string.IsNullOrEmpty(submitInfo.quote_result) ? submitInfo.quote_result : "", SubmitStatus = submitInfo.submit_status.HasValue ? submitInfo.submit_status.Value : 0, SubmitResult = !string.IsNullOrEmpty(submitInfo.submit_result) ? submitInfo.submit_result : "", JiaoQiang = savequote.JiaoQiang.HasValue ? savequote.JiaoQiang.Value : 1, CheSun = new XianZhongUnit { //BaoE = savequote.CheSun.HasValue ? savequote.CheSun.Value : 0, BaoE = isquoteresult ? (quoteresult.CheSunBE.HasValue ? quoteresult.CheSunBE.Value : 0) : (savequote.CheSun.HasValue ? savequote.CheSun.Value : 0), BaoFei = quoteresult.CheSun.HasValue ? (newRate == null ? quoteresult.CheSun.Value : System.Math.Round((double)quoteresult.CheSun.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SanZhe = new XianZhongUnit { BaoE = savequote.SanZhe.HasValue ? savequote.SanZhe.Value : 0, BaoFei = quoteresult.SanZhe.HasValue ? (newRate == null ? quoteresult.SanZhe.Value : System.Math.Round((double)quoteresult.SanZhe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, DaoQiang = new XianZhongUnit { BaoE = isquoteresult ? (quoteresult.DaoQiangBE.HasValue ? quoteresult.DaoQiangBE.Value : 0) : (savequote.DaoQiang.HasValue ? savequote.DaoQiang.Value : 0), BaoFei = quoteresult.DaoQiang.HasValue ? (newRate == null ? quoteresult.DaoQiang.Value : System.Math.Round((double)quoteresult.DaoQiang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SanZheJieJiaRi = new XianZhongUnit { BaoE = (savequote.SanZheJieJiaRi.HasValue ? savequote.SanZheJieJiaRi.Value : 0) > 0 ? 1 : 0, BaoFei = quoteresult.SanZheJieJiaRi.HasValue ? (newRate == null ? quoteresult.SanZheJieJiaRi.Value : System.Math.Round((double)quoteresult.SanZheJieJiaRi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, SiJi = new XianZhongUnit { BaoE = savequote.SiJi.HasValue ? savequote.SiJi.Value : 0, BaoFei = quoteresult.SiJi.HasValue ? (newRate == null ? quoteresult.SiJi.Value : System.Math.Round((double)quoteresult.SiJi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, ChengKe = new XianZhongUnit { BaoE = savequote.ChengKe.HasValue ? savequote.ChengKe.Value : 0, BaoFei = quoteresult.ChengKe.HasValue ? (newRate == null ? quoteresult.ChengKe.Value : System.Math.Round((double)quoteresult.ChengKe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BoLi = new XianZhongUnit { BaoE = savequote.BoLi.HasValue ? savequote.BoLi.Value : 0, BaoFei = quoteresult.BoLi.HasValue ? (newRate == null ? quoteresult.BoLi.Value : System.Math.Round((double)quoteresult.BoLi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HuaHen = new XianZhongUnit { BaoE = savequote.HuaHen.HasValue ? savequote.HuaHen.Value : 0, BaoFei = quoteresult.HuaHen.HasValue ? (newRate == null ? quoteresult.HuaHen.Value : System.Math.Round((double)quoteresult.HuaHen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianCheSun = new XianZhongUnit { BaoE = savequote.BuJiMianCheSun.HasValue ? savequote.BuJiMianCheSun.Value : 0, BaoFei = quoteresult.BuJiMianCheSun.HasValue ? (newRate == null ? quoteresult.BuJiMianCheSun.Value : System.Math.Round((double)quoteresult.BuJiMianCheSun.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSanZhe = new XianZhongUnit { BaoE = savequote.BuJiMianSanZhe.HasValue ? savequote.BuJiMianSanZhe.Value : 0, BaoFei = quoteresult.BuJiMianSanZhe.HasValue ? (newRate == null ? quoteresult.BuJiMianSanZhe.Value : System.Math.Round((double)quoteresult.BuJiMianSanZhe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianDaoQiang = new XianZhongUnit { BaoE = savequote.BuJiMianDaoQiang.HasValue ? savequote.BuJiMianDaoQiang.Value : 0, BaoFei = quoteresult.BuJiMianDaoQiang.HasValue ? (newRate == null ? quoteresult.BuJiMianDaoQiang.Value : System.Math.Round((double)quoteresult.BuJiMianDaoQiang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianRenYuan = new XianZhongUnit { BaoE = savequote.BuJiMianRenYuan.HasValue ? savequote.BuJiMianRenYuan.Value : 0, BaoFei = quoteresult.BuJiMianRenYuan.HasValue ? (newRate == null ? quoteresult.BuJiMianRenYuan.Value : System.Math.Round((double)quoteresult.BuJiMianRenYuan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianFuJia = new XianZhongUnit { BaoE = savequote.BuJiMianFuJian.HasValue ? savequote.BuJiMianFuJian.Value : 0, BaoFei = quoteresult.BuJiMianFuJian.HasValue ? (newRate == null ? quoteresult.BuJiMianFuJian.Value : System.Math.Round((double)quoteresult.BuJiMianFuJian.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //2.1.5版本 修改 增加6个字段 BuJiMianChengKe = new XianZhongUnit() { BaoE = savequote.BuJiMianChengKe.HasValue ? savequote.BuJiMianChengKe.Value : 0, BaoFei = quoteresult.BuJiMianChengKe.HasValue ? (newRate == null ? quoteresult.BuJiMianChengKe.Value : System.Math.Round((double)quoteresult.BuJiMianChengKe.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSiJi = new XianZhongUnit() { BaoE = savequote.BuJiMianSiJi.HasValue ? savequote.BuJiMianSiJi.Value : 0, BaoFei = quoteresult.BuJiMianSiJi.HasValue ? (newRate == null ? quoteresult.BuJiMianSiJi.Value : System.Math.Round((double)quoteresult.BuJiMianSiJi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianHuaHen = new XianZhongUnit() { BaoE = savequote.BuJiMianHuaHen.HasValue ? savequote.BuJiMianHuaHen.Value : 0, BaoFei = quoteresult.BuJiMianHuaHen.HasValue ? (newRate == null ? quoteresult.BuJiMianHuaHen.Value : System.Math.Round((double)quoteresult.BuJiMianHuaHen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianSheShui = new XianZhongUnit() { BaoE = savequote.BuJiMianSheShui.HasValue ? savequote.BuJiMianSheShui.Value : 0, BaoFei = quoteresult.BuJiMianSheShui.HasValue ? (newRate == null ? quoteresult.BuJiMianSheShui.Value : System.Math.Round((double)quoteresult.BuJiMianSheShui.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianZiRan = new XianZhongUnit() { BaoE = savequote.BuJiMianZiRan.HasValue ? savequote.BuJiMianZiRan.Value : 0, BaoFei = quoteresult.BuJiMianZiRan.HasValue ? (newRate == null ? quoteresult.BuJiMianZiRan.Value : System.Math.Round((double)quoteresult.BuJiMianZiRan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, BuJiMianJingShenSunShi = new XianZhongUnit() { BaoE = savequote.BuJiMianJingShenSunShi.HasValue ? savequote.BuJiMianJingShenSunShi.Value : 0, BaoFei = quoteresult.BuJiMianJingShenSunShi.HasValue ? (newRate == null ? quoteresult.BuJiMianJingShenSunShi.Value : System.Math.Round((double)quoteresult.BuJiMianJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //2.1.5修改结束 //2.1.5修改补充 HcSheBeiSunshi = new XianZhongUnit { BaoE = savequote.HcSheBeiSunshi.HasValue ? savequote.HcSheBeiSunshi.Value : 0, BaoFei = quoteresult.HcSheBeiSunshi.HasValue ? (newRate == null ? quoteresult.HcSheBeiSunshi.Value : System.Math.Round((double)quoteresult.HcSheBeiSunshi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcHuoWuZeRen = new XianZhongUnit { BaoE = savequote.HcHuoWuZeRen.HasValue ? savequote.HcHuoWuZeRen.Value : 0, BaoFei = quoteresult.HcHuoWuZeRen.HasValue ? (newRate == null ? quoteresult.HcHuoWuZeRen.Value : System.Math.Round((double)quoteresult.HcHuoWuZeRen.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, //HcFeiYongBuChang = new XianZhongUnit //{ // BaoE = savequote.HcFeiYongBuChang.HasValue ? savequote.HcFeiYongBuChang.Value : 0, // BaoFei = quoteresult.HcFeiYongBuChang.HasValue ? quoteresult.HcFeiYongBuChang.Value : 0 //}, HcJingShenSunShi = new XianZhongUnit { BaoE = savequote.HcJingShenSunShi.HasValue ? savequote.HcJingShenSunShi.Value : 0, BaoFei = quoteresult.HcJingShenSunShi.HasValue ? (newRate == null ? quoteresult.HcJingShenSunShi.Value : System.Math.Round((double)quoteresult.HcJingShenSunShi.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcSanFangTeYue = new XianZhongUnit { BaoE = savequote.HcSanFangTeYue.HasValue ? savequote.HcSanFangTeYue.Value : 0, BaoFei = quoteresult.HcSanFangTeYue.HasValue ? (newRate == null ? quoteresult.HcSanFangTeYue.Value : System.Math.Round((double)quoteresult.HcSanFangTeYue.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcXiuLiChang = new XianZhongUnit { BaoE = savequote.HcXiuLiChang.HasValue ? savequote.HcXiuLiChang.Value : 0, BaoFei = quoteresult.HcXiuLiChang.HasValue ? (newRate == null ? quoteresult.HcXiuLiChang.Value : System.Math.Round((double)quoteresult.HcXiuLiChang.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, HcXiuLiChangType = savequote.HcXiuLiChangType.HasValue ? savequote.HcXiuLiChangType.Value.ToString() : string.Empty, //2.1.5修改补充结束 SheShui = new XianZhongUnit { BaoE = savequote.SheShui.HasValue ? savequote.SheShui.Value : 0, BaoFei = quoteresult.SheShui.HasValue ? (newRate == null ? quoteresult.SheShui.Value : System.Math.Round((double)quoteresult.SheShui.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, CheDeng = new XianZhongUnit { BaoE = savequote.CheDeng.HasValue ? savequote.CheDeng.Value : 0, BaoFei = quoteresult.CheDeng.HasValue ? (newRate == null ? quoteresult.CheDeng.Value : System.Math.Round((double)quoteresult.CheDeng.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, ZiRan = new XianZhongUnit { BaoE = isquoteresult ? (quoteresult.ZiRanBE.HasValue ? quoteresult.ZiRanBE.Value : 0) : (savequote.ZiRan.HasValue ? savequote.ZiRan.Value : 0), BaoFei = quoteresult.ZiRan.HasValue ? (newRate == null ? quoteresult.ZiRan.Value : System.Math.Round((double)quoteresult.ZiRan.Value / (double)quoteresult.TotalRate * (double)newRate, 2)) : 0 }, RateFactor1 = quoteresult.RateFactor1.HasValue ? quoteresult.RateFactor1.Value : 0, RateFactor2 = quoteresult.RateFactor2.HasValue ? quoteresult.RateFactor2.Value : 0, RateFactor3 = quoteresult.RateFactor3.HasValue ? quoteresult.RateFactor3.Value : 0, RateFactor4 = quoteresult.RateFactor4.HasValue ? quoteresult.RateFactor4.Value : 0, TotalRate = (quoteresult.TotalRate ?? 0).ToString(CultureInfo.InvariantCulture), BizTno = string.IsNullOrEmpty(submitInfo.biz_tno) ? string.Empty : submitInfo.biz_tno, ForceTno = string.IsNullOrEmpty(submitInfo.force_tno) ? string.Empty : submitInfo.force_tno, Fybc = new XianZhongUnit { BaoE = savequote.HcFeiYongBuChang.HasValue ? savequote.HcFeiYongBuChang.Value : 0, BaoFei = quoteresult.HcFeiYongBuChang.HasValue ? quoteresult.HcFeiYongBuChang.Value : 0 }, FybcDays = new XianZhongUnit() { BaoE = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0, BaoFei = savequote.FeiYongBuChangDays.HasValue ? savequote.FeiYongBuChangDays.Value : 0 }, SheBeiSunShi = new XianZhongUnit { BaoE = savequote.HcSheBeiSunshi ?? 0, BaoFei = quoteresult.HcSheBeiSunshi ?? 0 }, BjmSheBeiSunShi = new XianZhongUnit { BaoE = savequote.BuJiMianSheBeiSunshi ?? 0, BaoFei = quoteresult.BuJiMianSheBeiSunshi ?? 0 }, OrderNo = string.IsNullOrEmpty(submitInfo.orderNo) ? "" : submitInfo.orderNo }; //安心三者,划痕特殊处理 if (quoteresult.Source == 12) { if (model.SanZhe.BaoE > 3000000) { model.SanZhe.BaoE = 3000000; } if (model.HuaHen.BaoE > 0) { model.HuaHen.BaoE = 10000; } //安心的国产车如果上了进口,则改为国产玻璃 if (model.BoLi.BaoE == 2) { if (!string.IsNullOrEmpty(carVin)) { if (carVin.StartsWith("L")) { model.BoLi.BaoE = 1; } } else { model.BoLi.BaoE = 1; } } } if (!quoteresult.TotalRate.HasValue) { model.TotalRate = (model.RateFactor1 * model.RateFactor2 * model.RateFactor3 * model.RateFactor4).ToString("f4"); } List <SheBei> sheBeis = new List <SheBei>(); if (!string.IsNullOrWhiteSpace(savequote.SheBeiSunShiConfig)) { var items = savequote.SheBeiSunShiConfig.FromJson <List <bx_devicedetail> >(); foreach (bx_devicedetail devicedetail in items) { var sb = new SheBei() { DN = string.IsNullOrWhiteSpace(devicedetail.device_name) ? string.Empty : devicedetail.device_name, DA = devicedetail.device_amount ?? 0, DD = devicedetail.device_depreciationamount ?? devicedetail.device_depreciationamount.Value, DQ = devicedetail.device_quantity ?? devicedetail.device_quantity.Value, DT = devicedetail.device_type ?? devicedetail.device_type.Value, PD = devicedetail.purchase_date.HasValue ? devicedetail.purchase_date.Value.ToString("yyyy-MM-dd") : string.Empty }; sheBeis.Add(sb); } } model.SheBeis = sheBeis; if (submitInfo.source == 0 || submitInfo.source == 3) { if (savequote.HcXiuLiChangType == 1) { if (savequote.HcXiuLiChang < 0.15) { model.HcXiuLiChang.BaoE = 0.15; } } } //取核保渠道 if (submitInfo.channel_id.HasValue && agentChannelList.Any()) { var channelmodel = agentChannelList.FirstOrDefault(s => s.Id == submitInfo.channel_id.Value); if (channelmodel != null) { var channel = new ChannelInfo { ChannelId = submitInfo.channel_id.Value, ChannelName = channelmodel.ConfigUkeyName ?? "", IsPaicApi = channelmodel.IsPaicApi.ToString() }; model.Channel = channel; } } if (model.Channel == null) {//如果没给model.Channel赋值,默认实例化 model.Channel = new ChannelInfo() { ChannelId = 0, ChannelName = "", IsPaicApi = "0" }; } //20181123add驾意险 double jiayitotal = 0; model.JiaYi = jiayi.ConvertViewModel(model.QuoteStatus, out jiayitotal); model.JiaYiTotal = jiayitotal.ToString(); if (quoteStatus == 0) { model.QuoteResult = model.QuoteStatus == 1 ? "报价失败" : (model.QuoteResult ?? ""); model.SubmitResult = model.QuoteStatus == 1 ? "报价失败未核保" : (model.SubmitResult ?? ""); model.QuoteStatus = 0; model.SubmitStatus = 5;//报价失败未核保 //险种 //model.BizRate = 0; //model.ForceRate = 0; model.BizTotal = 0; model.ForceTotal = 0; model.TaxTotal = 0; model.CheSun.BaoFei = 0; model.SanZhe.BaoFei = 0; model.DaoQiang.BaoFei = 0; model.SiJi.BaoFei = 0; model.ChengKe.BaoFei = 0; model.BoLi.BaoFei = 0; model.HuaHen.BaoFei = 0; model.BuJiMianCheSun.BaoFei = 0; model.BuJiMianSanZhe.BaoFei = 0; model.BuJiMianDaoQiang.BaoFei = 0; model.BuJiMianRenYuan.BaoFei = 0; model.BuJiMianFuJia.BaoFei = 0; model.BuJiMianChengKe.BaoFei = 0; model.BuJiMianSiJi.BaoFei = 0; model.BuJiMianHuaHen.BaoFei = 0; model.BuJiMianSheShui.BaoFei = 0; model.BuJiMianZiRan.BaoFei = 0; model.BuJiMianJingShenSunShi.BaoFei = 0; model.HcSheBeiSunshi.BaoFei = 0; model.HcHuoWuZeRen.BaoFei = 0; //model.HcFeiYongBuChang.BaoFei = 0; model.HcJingShenSunShi.BaoFei = 0; model.HcSanFangTeYue.BaoFei = 0; model.HcXiuLiChang.BaoFei = 0; model.SheShui.BaoFei = 0; model.CheDeng.BaoFei = 0; model.ZiRan.BaoFei = 0; //model.RateFactor1 = 0; //model.RateFactor2 = 0; //model.RateFactor3 = 0; //model.RateFactor4 = 0; //model.BizTno = "", //model.ForceTno = "", model.Fybc.BaoFei = 0; model.FybcDays.BaoFei = 0; model.SheBeiSunShi.BaoFei = 0; model.BjmSheBeiSunShi.BaoFei = 0; } model.PingAnScore = (quoteresult.PingAnScore ?? 0).ToString(CultureInfo.InvariantCulture); model.RepeatSubmitResult = (submitInfo.is_repeat_submit ?? 0).ToString(); model.ExpectedLossRate = (quoteresult.biz_expected_loss_rate ?? 0).ToString(); if (submitInfo.source == 2) { model.VersionType = submitInfo.VersionType == "Rb_Marketing_version" ? "1" : "0"; } else { model.VersionType = "0"; } #region 是否为人保版本第三代 model.IsRB3Version = "0"; if (!string.IsNullOrWhiteSpace(submitInfo.VersionType)) { switch (submitInfo.VersionType) { case "Rb_Marketing_version": model.IsRB3Version = "0"; break; case "Rb_VFour_JL_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_LN_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_HuBei_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_HB_Artificial_version": model.IsRB3Version = "0"; break; case "Rb_VFour_CQ_Artificial_version": model.IsRB3Version = "0"; break; default: model.IsRB3Version = "1"; break; } } #endregion model.ValidateCar = new ValidateCar() { BizValidateCar = (submitInfo.BizcInspectorNme ?? 0).ToString(), ForceValidateCar = (submitInfo.ForcecInspectorNme ?? 0).ToString(), IsValidateCar = ((submitInfo.ForcecInspectorNme ?? 0) | (submitInfo.BizcInspectorNme ?? 0)).ToString() }; //新增错误编码和结果 model.QuoteErrorCode = submitInfo.ErrorCodeToC.HasValue ? submitInfo.ErrorCodeToC.Value.ToString() : ""; model.QuoteErrorResult = submitInfo.quote_result_toc ?? ""; model.ActualDiscounts = (quoteresult.ActualDiscounts ?? 0).ToString(); return(model); }
public static PrecisePriceInfo ConvertToPrecisePriceInfo(int source, bx_quoteresult quoteresult, bx_submit_info submitInfo) { var myInfo = new PrecisePriceInfo(); if (quoteresult != null) { myInfo.BizTotal = quoteresult.BizTotal.HasValue ? quoteresult.BizTotal.Value : 0; double force = quoteresult.ForceTotal.HasValue ? quoteresult.ForceTotal.Value : 0; double tax = quoteresult.TaxTotal.HasValue ? quoteresult.TaxTotal.Value : 0; myInfo.ForceTotal = force + tax; } if (submitInfo != null) { myInfo.QuoteStatus = submitInfo.quote_status.HasValue ? submitInfo.quote_status.Value : 0; if (submitInfo.submit_status.HasValue) { myInfo.SubmitStatus = submitInfo.submit_status.Value; switch (myInfo.SubmitStatus) { case 0: myInfo.SubmitResult = "核保失败"; break; case 1: myInfo.SubmitResult = "核保成功"; break; case 2: myInfo.SubmitResult = "未到期未核保"; break; case 3: myInfo.SubmitResult = "人工审核中"; break; case 4: myInfo.SubmitResult = "非意向未核保"; break; case 5: myInfo.SubmitResult = "报价失败未核保"; break; default: myInfo.SubmitResult = ""; break; } } } myInfo.Source = SourceGroupAlgorithm.GetNewSource(source); return(myInfo); }
public long CreateOrder(bx_car_order order, bx_address address, bx_lastinfo lastinfo, bx_userinfo userinfo, bx_savequote savequote, bx_submit_info submitInfo, bx_quoteresult quoteresult, bx_quoteresult_carinfo carInfo, List <bx_claim_detail> claimDetails) { //如果此四张表数据为空,提示插入失败 //if (userinfo == null || savequote == null || submitInfo == null || quoteresult == null) if (userinfo == null) { return(0); } long orderid = 0; using (TransactionScope scope = new TransactionScope()) { try { //插入订单 var neworder = DataContextFactory.GetDataContext().bx_car_order.Add(order); DataContextFactory.GetDataContext().SaveChanges(); orderid = neworder.id; if (orderid > 0) { #region CarOrderUserInfoRepository bx_order_userinfo orderUserinfo = new bx_order_userinfo() { Id = userinfo.Id, LicenseNo = userinfo.LicenseNo, OpenId = userinfo.OpenId, CityCode = userinfo.CityCode, EngineNo = userinfo.EngineNo, CarVIN = userinfo.CarVIN, MoldName = userinfo.MoldName, RegisterDate = userinfo.RegisterDate, Agent = userinfo.Agent, LicenseOwner = userinfo.LicenseOwner, CarType = carInfo != null ? carInfo.car_type : null, CarUsedType = carInfo != null ? carInfo.car_used_type : null, JiaoQiangEndDate = lastinfo != null ? (!string.IsNullOrEmpty(lastinfo.last_end_date) ? lastinfo.last_end_date : "") : "", ShangYeEndDate = lastinfo != null ? (!string.IsNullOrEmpty(lastinfo.last_business_end_date) ? lastinfo.last_business_end_date : "") : "", //2017.2.7新增 LastYearSource = userinfo.LastYearSource, InsuredName = userinfo.InsuredName, InsuredMobile = userinfo.InsuredMobile, InsuredIdCard = userinfo.InsuredIdCard, InsuredAddress = userinfo.InsuredAddress, RenewalType = userinfo.RenewalType, InsuredIdType = userinfo.InsuredIdType, OwnerIdCardType = userinfo.OwnerIdCardType, Email = userinfo.Email, nonclaim_discount_rate = lastinfo != null ? lastinfo.nonclaim_discount_rate : null, last_year_acctimes = lastinfo != null ? lastinfo.last_year_acctimes : null, last_year_claimamount = lastinfo != null ? lastinfo.last_year_claimamount : null, last_year_claimtimes = lastinfo != null ? lastinfo.last_year_claimtimes : null, //end新增 OrderId = orderid }; #endregion var re_ui = DataContextFactory.GetDataContext().bx_order_userinfo.Add(orderUserinfo); DataContextFactory.GetDataContext().SaveChanges(); if (quoteresult != null) { #region CarOrderQuoteResultRepository bx_order_quoteresult orderQuoteresult = new bx_order_quoteresult() { B_Uid = quoteresult.B_Uid, CreateTime = quoteresult.CreateTime, CheSun = quoteresult.CheSun, SanZhe = quoteresult.SanZhe, DaoQiang = quoteresult.DaoQiang, SiJi = quoteresult.SiJi, ChengKe = quoteresult.ChengKe, BoLi = quoteresult.BoLi, HuaHen = quoteresult.HuaHen, BuJiMianCheSun = quoteresult.BuJiMianCheSun, BuJiMianSanZhe = quoteresult.BuJiMianSanZhe, BuJiMianDaoQiang = quoteresult.BuJiMianDaoQiang, BuJiMianRenYuan = quoteresult.BuJiMianRenYuan, BuJiMianFuJian = quoteresult.BuJiMianFuJian, //2.1.5版本修改 增加6个字段 BuJiMianChengKe = quoteresult.BuJiMianChengKe, BuJiMianSiJi = quoteresult.BuJiMianSiJi, BuJiMianHuaHen = quoteresult.BuJiMianHuaHen, BuJiMianSheShui = quoteresult.BuJiMianSheShui, BuJiMianZiRan = quoteresult.BuJiMianZiRan, BuJiMianJingShenSunShi = quoteresult.BuJiMianJingShenSunShi, TeYue = quoteresult.TeYue, SheShui = quoteresult.SheShui, CheDeng = quoteresult.CheDeng, ZiRan = quoteresult.ZiRan, BizTotal = quoteresult.BizTotal, ForceTotal = quoteresult.ForceTotal, TaxTotal = quoteresult.TaxTotal, BizContent = quoteresult.BizContent, ForceContent = quoteresult.ForceContent, SavedAmount = quoteresult.SavedAmount, Source = quoteresult.Source, BizStartDate = quoteresult.BizStartDate, ForceStartDate = quoteresult.ForceStartDate, HcSheBeiSunshi = quoteresult.HcSheBeiSunshi, HcHuoWuZeRen = quoteresult.HcHuoWuZeRen, HcFeiYongBuChang = quoteresult.HcFeiYongBuChang, HcJingShenSunShi = quoteresult.HcJingShenSunShi, HcSanFangTeYue = quoteresult.HcSanFangTeYue, HcXiuLiChang = quoteresult.HcXiuLiChang, InsuredName = quoteresult.InsuredName, InsuredIdCard = quoteresult.InsuredIdCard, InsuredIdType = quoteresult.InsuredIdType, InsuredMobile = quoteresult.InsuredMobile, HolderName = quoteresult.HolderName, HolderIdCard = quoteresult.HolderIdCard, HolderIdType = quoteresult.HolderIdType, HolderMobile = quoteresult.HolderMobile, RateFactor1 = quoteresult.RateFactor1, RateFactor2 = quoteresult.RateFactor2, RateFactor3 = quoteresult.RateFactor3, RateFactor4 = quoteresult.RateFactor4, //2017.2.7新增 HcXiuLiChangType = quoteresult.HcXiuLiChangType, CheSunBE = quoteresult.CheSunBE, ZiRanBE = quoteresult.ZiRanBE, DaoQiangBE = quoteresult.DaoQiangBE, //end新增 OrderId = orderid }; #endregion var re_qr = DataContextFactory.GetDataContext().bx_order_quoteresult.Add(orderQuoteresult); DataContextFactory.GetDataContext().SaveChanges(); } if (savequote != null) { #region CarOrderSaveQuoteRepository bx_order_savequote orderSavequote = new bx_order_savequote() { B_Uid = savequote.B_Uid, CheSun = savequote.CheSun, SanZhe = savequote.SanZhe, DaoQiang = savequote.DaoQiang, SiJi = savequote.SiJi, ChengKe = savequote.ChengKe, BoLi = savequote.BoLi, HuaHen = savequote.HuaHen, BuJiMianCheSun = savequote.BuJiMianCheSun, BuJiMianSanZhe = savequote.BuJiMianSanZhe, BuJiMianDaoQiang = savequote.BuJiMianDaoQiang, BuJiMianRenYuan = savequote.BuJiMianRenYuan, BuJiMianFuJian = savequote.BuJiMianFuJian, //2.1.5版本修改 增加6个字段 BuJiMianChengKe = savequote.BuJiMianChengKe, BuJiMianSiJi = savequote.BuJiMianSiJi, BuJiMianHuaHen = savequote.BuJiMianHuaHen, BuJiMianSheShui = savequote.BuJiMianSheShui, BuJiMianZiRan = savequote.BuJiMianZiRan, BuJiMianJingShenSunShi = savequote.BuJiMianJingShenSunShi, TeYue = savequote.TeYue, SheShui = savequote.SheShui, CheDeng = savequote.CheDeng, ZiRan = savequote.ZiRan, IsRenewal = savequote.IsRenewal, CreateTime = savequote.CreateTime, JiaoQiang = savequote.JiaoQiang, BizStartDate = savequote.BizStartDate, HcSheBeiSunshi = savequote.HcSheBeiSunshi, HcHuoWuZeRen = savequote.HcHuoWuZeRen, HcFeiYongBuChang = savequote.HcFeiYongBuChang, HcJingShenSunShi = savequote.HcJingShenSunShi, HcSanFangTeYue = savequote.HcSanFangTeYue, HcXiuLiChang = savequote.HcXiuLiChang, //2017.2.7新增 SheBeiSunShiConfig = savequote.SheBeiSunShiConfig, FeiYongBuChangConfig = savequote.FeiYongBuChangConfig, XiuLiChangConfig = savequote.XiuLiChangConfig, co_real_value = savequote.co_real_value, //end新增 OrderId = orderid }; #endregion var re_sqr = DataContextFactory.GetDataContext().bx_order_savequote.Add(orderSavequote); DataContextFactory.GetDataContext().SaveChanges(); } if (submitInfo != null) { #region CarOrderSubmitInfoRepository bx_order_submit_info orderSubmitInfo = new bx_order_submit_info() { b_uid = submitInfo.b_uid, license_no = submitInfo.license_no, mobile = submitInfo.mobile, source = submitInfo.source, biz_tno = submitInfo.biz_tno, biz_pno = submitInfo.biz_pno, biz_start_time = submitInfo.biz_start_time, biz_end_time = submitInfo.biz_end_time, force_tno = submitInfo.force_tno, force_pno = submitInfo.force_pno, force_start_time = submitInfo.force_start_time, force_end_time = submitInfo.force_end_time, submit_status = submitInfo.submit_status, submit_result = submitInfo.submit_result, quote_status = submitInfo.quote_status, quote_result = submitInfo.quote_result, biz_rate = submitInfo.biz_rate, force_rate = submitInfo.force_rate, create_time = submitInfo.create_time, update_time = submitInfo.update_time, submit_result_toc = submitInfo.submit_result_toc, quote_result_toc = submitInfo.quote_result_toc, channel_id = submitInfo.channel_id, //2017.2.7新增 err_code = submitInfo.err_code, //end新增 OrderId = orderid }; #endregion var re_si = DataContextFactory.GetDataContext().bx_order_submit_info.Add(orderSubmitInfo); DataContextFactory.GetDataContext().SaveChanges(); } scope.Complete(); } } //catch (DbEntityValidationException dbEx) //{ // foreach (var validationErrors in dbEx.EntityValidationErrors) // { // foreach (var validationError in validationErrors.ValidationErrors) // { // logError.Info(string.Format("Property: {0} Error: {1}", // validationError.PropertyName, // validationError.ErrorMessage)); // } // } //} catch (Exception ex) { logError.Info("发生异常:事务订单号(" + orderid + ")\n" + ex.Source + "\n" + ex.StackTrace + "\n" + ex.Message + "\n" + ex.InnerException); } finally { //orderid = 0; scope.Dispose(); } } return(orderid); }