From bce2ec0274b8ae765bfb318b701e41a82a53ba0e Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期五, 06 六月 2025 17:45:29 +0800 Subject: [PATCH] pref:渠道字段添加 --- LifePayment/LifePayment.Application/LifePay/LifePayService.cs | 53 ++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 40 insertions(+), 13 deletions(-) diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs index ee425c3..379bf86 100644 --- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs +++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs @@ -50,10 +50,12 @@ private readonly InitSetting _initSettingOptions; private readonly IACOOLYManager _aCOOLYManager; + private readonly IRepository<LifePayPromoter, Guid> lifePayPromoterRepository; public LifePayService(IDistributedEventBus distributedEventBus, ILogger<LifePayService> logger, IACOOLYManager aCOOLYManager, + IRepository<LifePayPromoter, Guid> lifePayPromoterRepository, IRepository<LifePayRate, Guid> lifePayRateRepository, IRepository<LifePayOrder, Guid> lifePayOrderRepository, IRepository<LifePayUser, Guid> lifePayUserRepository, @@ -74,6 +76,7 @@ { _logger = logger; _aCOOLYManager = aCOOLYManager; + this.lifePayPromoterRepository = lifePayPromoterRepository; _lifePayRateRepository = lifePayRateRepository; _lifePayOrderRepository = lifePayOrderRepository; _lifePayUserRepository = lifePayUserRepository; @@ -1714,13 +1717,22 @@ { var dto = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.Id == input.Id.Value); CheckExtensions.IfTrueThrowUserFriendlyException(dto == null, "鏈幏鍙栧埌娓犻亾鎶樻墸鏁版嵁"); + if (!string.IsNullOrWhiteSpace(input.PromoterIdNumber) || !string.IsNullOrWhiteSpace(input.PromoterName)) + { + var promoter = await lifePayPromoterRepository.FirstOrDefaultAsync(it => it.IdNumber == input.PromoterIdNumber && it.Name == input.PromoterName); + CheckExtensions.IfTrueThrowUserFriendlyException(promoter == null, "璇ユ帹骞夸汉涓嶅瓨鍦�"); + dto.PromoterId = promoter.Id; + } + dto.ChannlesName = input.ChannlesName; dto.ChannlesNum = input.ChannlesNum; dto.ChannlesRate = input.ChannlesRate; dto.ChannlesRakeRate = input.ChannlesRakeRate; dto.SwitchType = input.SwitchType; dto.ChannlesType = input.ChannlesType; - dto.Status = input.Status; + dto.AgentType = input.AgentType; + dto.AreaProvinceId = input.AreaProvinceId; + dto.AreaCityId = input.AreaCityId; #region 璁板綍鏃ュ織 await LifePayOrderHistory("娓犻亾绠$悊", "缂栬緫", input.Id.Value, TableType.LifePayChannles); @@ -1732,6 +1744,13 @@ CheckExtensions.IfTrueThrowUserFriendlyException(input.ChannlesRate < 0.01m, "娓犻亾鎶樻墸璁剧疆閿欒"); input.Id = Guid.NewGuid(); var entity = ObjectMapper.Map<CreateEditPayChannelsInput, LifePayChannles>(input); + if (!string.IsNullOrWhiteSpace(input.PromoterIdNumber) || !string.IsNullOrWhiteSpace(input.PromoterName)) + { + var promoter = await lifePayPromoterRepository.FirstOrDefaultAsync(it => it.IdNumber == input.PromoterIdNumber && it.Name == input.PromoterName); + CheckExtensions.IfTrueThrowUserFriendlyException(promoter == null, "璇ユ帹骞夸汉涓嶅瓨鍦�"); + entity.PromoterId = promoter.Id; + } + await _lifePayChannlesRep.InsertAsync(entity); #region 璁板綍鏃ュ織 @@ -2181,20 +2200,28 @@ }); return result; } + private IQueryable<CreateEditPayChannelsInput> GetLifePayChannlesListFilter() { - return _lifePayChannlesRep.Select(x => - new CreateEditPayChannelsInput - { - Id = x.Id, - ChannlesRate = x.ChannlesRate, - ChannlesRakeRate = x.ChannlesRakeRate, - ChannlesName = x.ChannlesName, - ChannlesNum = x.ChannlesNum, - Status = x.Status, - SwitchType = x.SwitchType, - ChannlesType = x.ChannlesType, - }); + return from x in _lifePayChannlesRep + join p in lifePayPromoterRepository on x.PromoterId equals p.Id into pg + from pgd in pg.DefaultIfEmpty() + select new CreateEditPayChannelsInput + { + Id = x.Id, + ChannlesRate = x.ChannlesRate, + ChannlesRakeRate = x.ChannlesRakeRate, + ChannlesName = x.ChannlesName, + ChannlesNum = x.ChannlesNum, + Status = x.Status, + SwitchType = x.SwitchType, + ChannlesType = x.ChannlesType, + AgentType = x.AgentType, + AreaProvinceId = x.AreaProvinceId, + AreaCityId = x.AreaCityId, + PromoterIdNumber = pgd.IdNumber, + PromoterName = pgd.Name, + }; } public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal platformRate, decimal channleRate, -- Gitblit v1.9.1