zhengyiming
20 小时以前 f7bb0825bc06b8cea32caa44d2326dde51990e77
LifePayment/LifePayment.Application/LifePay/LifePayRateService.cs
@@ -46,7 +46,10 @@
    /// <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>
@@ -59,7 +62,7 @@
        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)
        {
@@ -112,6 +115,30 @@
        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