public BaseResponse CheckRequest(GetPrecisePriceRequest request, IEnumerable <KeyValuePair <string, string> > pairs) { BaseResponse response = new BaseResponse(); response.Status = HttpStatusCode.OK; //校验:1基础校验 BaseResponse baseResponse = _validateService.Validate(request, pairs); if (baseResponse.Status == HttpStatusCode.Forbidden) { response.Status = HttpStatusCode.Forbidden; response.ErrMsg = baseResponse.ErrMsg; logError.Info(request.ToJson() + ";校验错误:" + response.ErrMsg); 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.Forbidden; response.ErrMsg = validateResult.Item1.ErrMsg; logError.Info(request.ToJson() + ";校验错误:" + response.ErrMsg); return(response); } //校验3:报价数据 baseResponse = _checkQuoteValidService.Validate(validateResult.Item2, request.QuoteGroup, 1); if (baseResponse.Status == HttpStatusCode.NotAcceptable) { response.Status = HttpStatusCode.Forbidden; response.ErrMsg = baseResponse.ErrMsg; logError.Info(request.ToJson() + ";校验错误:" + validateResult.Item2.Id + ":" + response.ErrMsg); return(response); } response.ErrMsg = baseResponse.ErrMsg; return(response); }
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 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 async Task <GetSpecialAssumpsitResponse> GetSpecialAssumpsit(GetSpecialAssumpsitRequest request, IEnumerable <KeyValuePair <string, string> > pair) { GetSpecialAssumpsitResponse response = new GetSpecialAssumpsitResponse(); //校验:1基础校验 BaseResponse baseResponse = _validateService.Validate(request, pair); 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); } //正式逻辑============= string baojiaCacheKey = CommonCacheKeyFactory.CreateKeyWithLicenseAndAgentAndCustKey(request.LicenseNo, request.Agent, request.CustKey + request.RenewalCarType); //通知中心 var msgBody = new { B_Uid = validateResult.Item2.Id, Source = SourceGroupAlgorithm.GetOldSource(request.Source), NotifyCacheKey = baojiaCacheKey, }; //发送安心核保消息 try { var baojiaKey = string.Format("{0}-GenerateSpecial-key", baojiaCacheKey); CacheProvider.Remove(baojiaKey); var msgbody = _messageCenter.SendToMessageCenter(msgBody.ToJson(), ConfigurationManager.AppSettings["MessageCenter"], ConfigurationManager.AppSettings["bxAnXinTeYue"]); var cacheKey = CacheProvider.Get <string>(baojiaKey); if (cacheKey == null) { for (int i = 0; i < 180; i++) { cacheKey = CacheProvider.Get <string>(baojiaKey); if (!string.IsNullOrWhiteSpace(cacheKey)) { break; } else { await Task.Delay(TimeSpan.FromSeconds(1)); } } } if (cacheKey == "1") { var msgModel = CacheProvider.Get <AXGainFixSpecInfoResponse>(string.Format("{0}-GenerateSpecial", baojiaCacheKey)); List <SpecialVO> SpecialContents = new List <SpecialVO>(); if (msgModel != null) { //取交强模型 if (msgModel.PackageJQVO != null) { if (msgModel.PackageJQVO.FixSpecList != null) { foreach (var item in msgModel.PackageJQVO.FixSpecList) { SpecialContents.Add(new SpecialVO() { CSpecNo = item.cSpecNo, CSysSpecContent = item.cSysSpecContent, Type = 1 }); } } } //取商业模型 if (msgModel.PackageSYVO != null) { if (msgModel.PackageSYVO.FixSpecList != null) { foreach (var item in msgModel.PackageSYVO.FixSpecList) { SpecialContents.Add(new SpecialVO() { CSpecNo = item.cSpecNo, CSysSpecContent = item.cSysSpecContent, Type = 2 }); } } } } response.SpecialContents = SpecialContents; } } catch (MessageException exception) { response.Status = HttpStatusCode.ExpectationFailed; response.ErrMsg = exception.Message; return(response); } return(response); }