Пример #1
0
        public GetSubmitInfoResponse GetSubmitInfo(GetSubmitInfoRequest request)
        {
            GetSubmitInfoResponse response = new GetSubmitInfoResponse();

            //获取核保信息
            //需要的表
            //bx_userinfo
            //bx_SubmitInfo

            //步骤1  续保的时候 会发送消息队列 ,这个时候 会把 key传过去eg:cccc。

            //步骤2   中心在续保的时候 ,需要根据这个key 设置1(因为最多只有一家核保)个开关 eg:cccc-hb-key:1,放在缓存中,成功的时候要置1,刚开始是空值
            //等续保结束后,先将上面列出的表写入缓存
            //其中: 键值分别是:
            //bx_userinfo        :cccc-userinfo
            //bx_SubmitInfo      :cccc-submitinfo

            //步骤3: 讲开关缓存设置核保完成标识:cccc-hb-key:1

            return(response);
        }
        public async Task <GetSubmitInfoResponse> GetSubmitInfo(GetSubmitInfoRequest request)
        {
            GetSubmitInfoResponse response = new GetSubmitInfoResponse();

            //获取核保信息
            //需要的表
            //bx_userinfo
            //bx_SubmitInfo

            //步骤1  续保的时候 会发送消息队列 ,这个时候 会把 key传过去eg:cccc。

            //步骤2   中心在续保的时候 ,需要根据这个key 设置1(因为最多只有一家核保)个开关 eg:cccc-hb-key:1,放在缓存中,成功的时候要置1,刚开始是空值
            //等续保结束后,先将上面列出的表写入缓存
            //其中: 键值分别是:
            //bx_SubmitInfo      :cccc-submitinfo

            //步骤3: 讲开关缓存设置核保完成标识:cccc-hb-0-key:1

            string hebaoCacheKey = CommonCacheKeyFactory.CreateKeyWithLicenseAndAgentAndCustKey(request.LicenseNo, request.Agent, request.CustKey + request.RenewalCarType);

            var hebaoKey = string.Format("{0}-{1}-hb-{2}", hebaoCacheKey, request.IntentionCompany, "key");
            //ExecutionContext.SuppressFlow();
            var cacheKey = CacheProvider.Get <string>(hebaoKey);

            if (cacheKey == null)
            {
                for (int i = 0; i < 220; i++)
                {
                    cacheKey = CacheProvider.Get <string>(hebaoKey);
                    if (!string.IsNullOrWhiteSpace(cacheKey))
                    {
                        break;
                    }
                    else
                    {
                        await Task.Delay(TimeSpan.FromSeconds(1));
                    }
                }
            }
            //ExecutionContext.RestoreFlow();
            string baojiaCacheOrderIdKey = string.Format("{0}OrderIdKey", hebaoCacheKey);
            var    ck = CacheProvider.Get <string>(baojiaCacheOrderIdKey);


            string baojiaCacheCheckCodeIdKey = string.Format("{0}CheckCodeKey", hebaoCacheKey);
            var    bk = CacheProvider.Get <string>(baojiaCacheCheckCodeIdKey);

            //CacheProvider.Set(baojiaCacheOrderIdKey, request.OrderId, 10800);//orderid 滴滴用 ,缓存3小时

            if (cacheKey == "1")
            {
                response.SubmitInfo = CacheProvider.Get <bx_submit_info>(string.Format("{0}-{1}-{2}", hebaoCacheKey,
                                                                                       request.IntentionCompany, "submitinfo"));

                response.BusinessStatus = 1;
            }
            else if (cacheKey == "0")
            {
                response.SubmitInfo = CacheProvider.Get <bx_submit_info>(string.Format("{0}-{1}-{2}", hebaoCacheKey,
                                                                                       request.IntentionCompany, "submitinfo"));
                response.CustKey        = request.CustKey;
                response.BusinessStatus = 3;
            }

            response.CustKey = request.CustKey;
            if (!string.IsNullOrWhiteSpace(ck))
            {
                response.OrderId = ck;
            }
            if (!string.IsNullOrWhiteSpace(bk))
            {
                response.CheckCode = bk;
            }
            return(response);
        }