//匹配扣点 public List <PolicyCache> DeductionSetting(string code, List <AVHData> avhList, List <PolicyCache> pclist) { PlatformDeductionParam pfDp = new PlatformDeductionParam(); foreach (AVHData leg in avhList) { pfDp.FlyLineList.Add(new FlyLine() { CarrayCode = leg.QueryParam.CarrierCode, FromCityCode = leg.QueryParam.FromCode, ToCityCode = leg.QueryParam.ToCode }); } DomesticService domesticService = ObjectFactory.GetInstance <DomesticService>(); UserRelation userRealtion = domesticService.GetUserRealtion(code); DeductionGroup deductionGroup = userRealtion.deductionGroup; List <string> codeList = ObjectFactory.GetAllInstances <IPlatform>().Select(p => p.Code).ToList(); DeductionType deductionType = DeductionType.Interface; EnumPolicySourceType PolicySourceType = EnumPolicySourceType.Interface; //本地运营的下级供应code List <string> LocalSupplierCodeList = userRealtion.SupplierList.Where(p => p.CarrierCode == userRealtion.carrier.Code).Select(p => p.Code).ToList(); for (int i = 0; i < pclist.Count; i++) { PolicyCache pc = pclist[i]; if (codeList.Contains(pc.PlatformCode)) { deductionType = DeductionType.Interface; PolicySourceType = EnumPolicySourceType.Interface; } else { if (userRealtion.carrier.Code == pc.PlatformCode || LocalSupplierCodeList.Contains(pc.PlatformCode)) { deductionType = DeductionType.Local; PolicySourceType = EnumPolicySourceType.Local; } else { deductionType = DeductionType.Share; PolicySourceType = EnumPolicySourceType.Share; } } pc.Point = domesticService.MatchDeductionRole(PolicyCacheToPolicy(pc, PolicySourceType), pfDp, pc.CarrierCode, deductionGroup, userRealtion, deductionType); } return(pclist); }
private Policy PolicyCacheToPolicy(PolicyCache pc, EnumPolicySourceType PolicySourceType) { Policy p = new Policy(); p.PolicyId = pc.PolicyId; p.CarryCode = pc.CarrierCode; p.PolicySourceType = PolicySourceType; p.Code = pc.PlatformCode; p.Name = pc.PlatformCode; p.PlatformCode = pc.PlatformCode; p.OriginalPolicyPoint = pc.Point; p.PaidPoint = pc.Point; p.DownPoint = 0m; p.PolicyPoint = pc.Point; p.DeductionDetails = p.DeductionDetails == null ? new List <DeductionDetail>() : p.DeductionDetails; return(p); }