Browse Source

charge

bjmzak
wxd 2 years ago
parent
commit
479c6cec21
  1. 4
      src/Shentun.Peis.Application.Contracts/CardRegisters/GetCardRegisterListDto.cs
  2. 7
      src/Shentun.Peis.Application.Contracts/ChargeBackPays/ChargeBackPayDto.cs
  3. 7
      src/Shentun.Peis.Application.Contracts/ChargePays/ChargePayDto.cs
  4. 5
      src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs
  5. 25
      src/Shentun.Peis.Application/ChargeBackPays/ChargeBackPayAppService.cs
  6. 20
      src/Shentun.Peis.Application/ChargePays/ChargePayAppService.cs

4
src/Shentun.Peis.Application.Contracts/CardRegisters/GetCardRegisterListDto.cs

@ -8,6 +8,10 @@ namespace Shentun.Peis.CardRegisters
{
public class GetCardRegisterListDto
{
/// <summary>
/// 卡模式 (0:充值卡,1:积分卡)
/// </summary>
public char? CardModeId { get; set; }
/// <summary>
/// 卡类型
/// </summary>

7
src/Shentun.Peis.Application.Contracts/ChargeBackPays/ChargeBackPayDto.cs

@ -24,8 +24,13 @@ namespace Shentun.Peis.ChargeBackPays
public decimal BackMoeny { get; set; }
/// <summary>
/// 卡记录ID
/// 卡消费记录ID
/// </summary>
public Guid? CardBillId { get; set; }
/// <summary>
/// 会员卡ID
/// </summary>
public Guid? CardRegisterId { get; set; }
}
}

7
src/Shentun.Peis.Application.Contracts/ChargePays/ChargePayDto.cs

@ -22,8 +22,13 @@ namespace Shentun.Peis.ChargePays
public decimal ChargeMoney { get; set; }
/// <summary>
/// 记账记录ID
/// 卡消费记录ID
/// </summary>
public Guid? CardBillId { get; set; }
/// <summary>
/// 会员卡ID
/// </summary>
public Guid? CardRegisterId { get; set; }
}
}

5
src/Shentun.Peis.Application/CardRegisters/CardRegisterAppService.cs

@ -46,6 +46,11 @@ namespace Shentun.Peis.CardRegisters
var cardRegisterList = (await _cardRegisterRepository.GetDbSetAsync())
.Include(x => x.CardType).AsEnumerable();
if (input.CardModeId != null)
{
cardRegisterList = cardRegisterList.Where(m => m.CardType.CardModeId == input.CardModeId);
}
if (input.CardTypeId != null && input.CardTypeId != Guid.Empty)
{
cardRegisterList = cardRegisterList.Where(m => m.CardTypeId == input.CardTypeId);

25
src/Shentun.Peis.Application/ChargeBackPays/ChargeBackPayAppService.cs

@ -1,6 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Shentun.Peis.ChargeAsbitems;
using Shentun.Peis.ChargePays;
using Shentun.Peis.Models;
using System;
using System.Collections.Generic;
@ -22,12 +23,15 @@ namespace Shentun.Peis.ChargeBackPays
public class ChargeBackPayAppService : ApplicationService
{
private readonly IRepository<ChargeBackPay> _chargeBackPayRepository;
private readonly IRepository<CardBill, Guid> _cardBillRepository;
public ChargeBackPayAppService(
IRepository<ChargeBackPay> chargeBackPayRepository
IRepository<ChargeBackPay> chargeBackPayRepository,
IRepository<CardBill, Guid> cardBillRepository
)
{
this._chargeBackPayRepository = chargeBackPayRepository;
this._cardBillRepository = cardBillRepository;
}
/// <summary>
@ -38,18 +42,33 @@ namespace Shentun.Peis.ChargeBackPays
[HttpGet("api/app/chargebackpay/getchargebackpayinchargebackid")]
public async Task<List<ChargeBackPayDto>> GetChargeBackPayInChargeBackIdAsync(Guid ChargeBackId)
{
var chargeBackPayList = await _chargeBackPayRepository.GetListAsync(m => m.ChargeBackId == ChargeBackId);
Guid? guidNull = null;
var chargeBackPayList = from a in (await _chargeBackPayRepository.GetQueryableAsync())
join b in (await _cardBillRepository.GetQueryableAsync()) on a.CardBillId equals b.Id into bb
from ab in bb.DefaultIfEmpty()
where a.ChargeBackId == ChargeBackId
select new
{
ChargeBackId = a.ChargeBackId,
CardBillId = a.CardBillId,
BackMoeny = a.BackMoeny,
PayModeId = a.PayModeId,
CardRegisterId = ab != null ? ab.CardRegisterId : guidNull,
};
var entlistdto = chargeBackPayList.Select(s => new ChargeBackPayDto
{
BackMoeny = s.BackMoeny,
ChargeBackId = s.ChargeBackId,
CardBillId = s.CardBillId,
PayModeId = s.PayModeId
PayModeId = s.PayModeId,
CardRegisterId = s.CardRegisterId
}).ToList();
return entlistdto;
}
}
}

20
src/Shentun.Peis.Application/ChargePays/ChargePayAppService.cs

@ -21,14 +21,17 @@ namespace Shentun.Peis.ChargePays
public class ChargePayAppService : ApplicationService
{
private readonly IRepository<ChargePay> _chargePayRepository;
private readonly IRepository<CardBill, Guid> _cardBillRepository;
private readonly IRepository<IdentityUser, Guid> _userRepository;
public ChargePayAppService(
IRepository<ChargePay> chargePayRepository,
IRepository<CardBill, Guid> cardBillRepository,
IRepository<IdentityUser, Guid> userRepository
)
{
this._chargePayRepository = chargePayRepository;
this._cardBillRepository = cardBillRepository;
this._userRepository = userRepository;
}
@ -40,15 +43,28 @@ namespace Shentun.Peis.ChargePays
[HttpGet("api/app/chargepay/getchargepayinchargeid")]
public async Task<List<ChargePayDto>> GetChargePayInChargeIdAsync(Guid ChargeId)
{
Guid? guidNull = null;
var chargePayList = await _chargePayRepository.GetListAsync(m => m.ChargeId == ChargeId);
var chargePayList = from a in (await _chargePayRepository.GetQueryableAsync())
join b in (await _cardBillRepository.GetQueryableAsync()) on a.CardBillId equals b.Id into bb
from ab in bb.DefaultIfEmpty()
where a.ChargeId == ChargeId
select new
{
ChargeId = a.ChargeId,
CardBillId = a.CardBillId,
ChargeMoney = a.ChargeMoney,
PayModeId = a.PayModeId,
CardRegisterId = ab != null ? ab.CardRegisterId : guidNull,
};
var entlistdto = chargePayList.Select(s => new ChargePayDto
{
ChargeId = s.ChargeId,
CardBillId = s.CardBillId,
ChargeMoney = s.ChargeMoney,
PayModeId = s.PayModeId
PayModeId = s.PayModeId,
CardRegisterId = s.CardRegisterId
}).ToList();
return entlistdto;

Loading…
Cancel
Save