コード例 #1
0
        private Policy GetLocalPolicy(PolicyParam policyParam, string policyId, string innerPlatformCode, UserRelation userRealtion, bool IspolicyIsNull, PolicyService policyService, Policy localPolicy)
        {
            PnrData pnrData = PnrHelper.GetPnrData(order.PnrContent);

            if (IspolicyIsNull)
            {
                //全部查询匹配一下
                localPolicy = policyService.GetLocalPolicy(userRealtion, innerPlatformCode, policyParam, pnrData).Find((p) => p.PolicyId == policyId);
                if (localPolicy == null)
                {
                    localPolicy = policyService.GetSharePolicy(userRealtion, innerPlatformCode, policyParam, pnrData).Find((p) => p.PolicyId == policyId);
                }
                if (localPolicy == null && policyId.StartsWith(userRealtion.carrier.Code + "_"))
                {
                    //本地 默认
                    localPolicy = policyService.GetDefaultPolicy(userRealtion, innerPlatformCode, policyParam, pnrData, policyId).FirstOrDefault();
                }
            }
            else
            {
                //非接口重新获取政策
                //本地
                localPolicy = policyService.GetLocalPolicy(userRealtion, innerPlatformCode, policyParam, pnrData).Find((p) => p.PolicyId == policyId);
                if (localPolicy == null)
                {
                    //共享 异地
                    localPolicy = policyService.GetSharePolicy(userRealtion, innerPlatformCode, policyParam, pnrData).Find((p) => p.PolicyId == policyId);
                }
                if (localPolicy == null)
                {
                    if (policyId.StartsWith(userRealtion.carrier.Code + "_"))
                    {
                        //本地 默认
                        localPolicy = policyService.GetDefaultPolicy(userRealtion, innerPlatformCode, policyParam, pnrData, policyId).FirstOrDefault();
                    }
                }
            }
            return(localPolicy);
        }