| | |
| | | /// <returns></returns> |
| | | public async Task<List<CreateEditRateChannelOutput>> GetLifePayRateChannelAllList(QueryRateChannelInput input) |
| | | { |
| | | return await GetLifePayRateChannelListFilter().WhereIf(input.Status.HasValue, x => x.Status == input.Status).OrderByDescending(r => r.CreationTime).ToListAsync(); |
| | | return await GetLifePayRateChannelListFilter() |
| | | .WhereIf(input.LifePayOrderType.HasValue, x => x.LifePayOrderType == input.LifePayOrderType) |
| | | .WhereIf(input.Status.HasValue, x => x.Status == input.Status) |
| | | .OrderBy(r => r.CreationTime).ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.SupplierRate < 0.01m, "供应商折扣设置错误"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.PlatformRate < 0.01m, "平台折扣设置错误"); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(input.PlatformRate < input.SupplierRate, "平台折扣无法低于供应商折扣"); |
| | | bool isExist = await _lifePayRateChannelRepository.AnyAsync(r => r.Code == input.Code); |
| | | bool isExist = await _lifePayRateChannelRepository.AnyAsync(r => (!input.Id.HasValue || r.Id != input.Id.Value) && r.Code == input.Code); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(isExist, "ID已存在"); |
| | | if (input.Id.HasValue) |
| | | { |
| | |
| | | return Constant.SUCCESS; |
| | | } |
| | | |
| | | public async Task<CreateEditRateChannelOutput> GetRateChannelByCode(string code) |
| | | { |
| | | var dto = await _lifePayRateChannelRepository.FirstOrDefaultAsync(x => x.Code == code); |
| | | if (dto == null) |
| | | { |
| | | return new CreateEditRateChannelOutput(); |
| | | } |
| | | else |
| | | { |
| | | return new CreateEditRateChannelOutput |
| | | { |
| | | Id = dto.Id, |
| | | LifePayOrderType = dto.LifePayOrderType, |
| | | RateChannelName = dto.RateChannelName, |
| | | Code = dto.Code, |
| | | SupplierRate = dto.SupplierRate, |
| | | PlatformRate = dto.PlatformRate, |
| | | Status = dto.Status, |
| | | Remark = dto.Remark, |
| | | CreationTime = dto.CreationTime, |
| | | }; |
| | | } |
| | | } |
| | | |
| | | private IQueryable<CreateEditRateChannelOutput> GetLifePayRateChannelListFilter() |
| | | { |
| | | var query = from x in _lifePayRateChannelRepository |