wxd 5 months ago
parent
commit
e3f3ce7cda
  1. 9
      src/Shentun.Peis.Application/ChargePays/ChargePayAppService.cs
  2. 21
      src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs
  3. 2
      src/Shentun.Peis.Domain/CardBills/CardBillManager.cs
  4. 2
      src/Shentun.Peis.Domain/ChargeBackPays/ChargeBackPay.cs
  5. 9
      src/Shentun.Peis.Domain/ChargeBacks/ChargeBack.cs

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

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Shentun.Peis.ChargeAsbitems;
using Shentun.Peis.Models;
using System;
@ -48,7 +49,7 @@ namespace Shentun.Peis.ChargePays
Guid? guidNull = null;
var chargePayList = from chargePay in await _chargePayRepository.GetQueryableAsync()
join cardBill in (await _cardBillRepository.GetQueryableAsync()) on chargePay.CardBillId equals cardBill.Id into cardBillTemp
join cardBill in await _cardBillRepository.GetQueryableAsync() on chargePay.CardBillId equals cardBill.Id into cardBillTemp
from cardBillEmpty in cardBillTemp.DefaultIfEmpty()
join cardRegister in await _cardRegisterRepository.GetQueryableAsync() on cardBillEmpty.CardRegisterId equals cardRegister.Id into cardRegisterTemp
from cardRegisterEmpty in cardRegisterTemp.DefaultIfEmpty()
@ -59,10 +60,12 @@ namespace Shentun.Peis.ChargePays
CardBillId = chargePay.CardBillId,
ChargeMoney = chargePay.ChargeMoney,
PayModeId = chargePay.PayModeId,
CardRegisterId = cardBillEmpty.CardRegisterId,
CardRegisterId = cardBillEmpty != null ? cardBillEmpty.CardRegisterId : guidNull,
cardNo = cardRegisterEmpty.CardNo
};
var entlistdto = chargePayList.Select(s => new ChargePayDto
{
ChargeId = s.ChargeId,
@ -71,7 +74,7 @@ namespace Shentun.Peis.ChargePays
PayModeId = s.PayModeId,
CardRegisterId = s.CardRegisterId,
CardNo = s.cardNo
}).ToList();
}).OrderBy(o => o.PayModeId).ToList();
return entlistdto;
}

21
src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs

@ -745,13 +745,14 @@ namespace Shentun.Peis.RegisterAsbitems
List<RegisterCheckAsbitem> registerAsbitems = await _registerCheckAsbitemRepository.GetListAsync(m => chargeAsbitemList.Select(s => s.RegisterAsbitemId).Contains(m.Id));
registerAsbitems.ForEach(f => f.IsCharge = 'N');
#region 插入主表Charge
Guid chargeBackId = GuidGenerator.Create();
ChargeBack chargeBack = new ChargeBack
ChargeBack chargeBack = new ChargeBack(chargeBackId)
{
ChargeId = input.ChargeId
};
var chargeBack_new = await _chargeBackRepository.InsertAsync(chargeBack); //退费主表
await _chargeBackRepository.InsertAsync(chargeBack); //退费主表
#region 退费方式
@ -761,8 +762,9 @@ namespace Shentun.Peis.RegisterAsbitems
{
if (item.PayModeId == "05")
{
Guid cardBillId = GuidGenerator.Create();
//会员卡
CardBill cardBill = new CardBill(GuidGenerator.Create())
CardBill cardBill = new CardBill(cardBillId)
{
PayModeId = item.PayModeId,
BillFlag = CardBillFlag.Refund,
@ -770,9 +772,8 @@ namespace Shentun.Peis.RegisterAsbitems
CardRegisterId = item.CardRegisterId.Value
};
cardBill = _cardBillManager.CreateAsync(cardBill);
var cardBill_new = await _cardBillRepository.InsertAsync(cardBill);
if (cardBill_new != null)
{
await _cardBillRepository.InsertAsync(cardBill);
#region 回退会员卡余额
var cardRegisterEnt = await _cardRegisterRepository.FirstOrDefaultAsync(f => f.Id == item.CardRegisterId.Value);
@ -787,10 +788,10 @@ namespace Shentun.Peis.RegisterAsbitems
{
BackMoeny = item.BackMoeny,
PayModeId = item.PayModeId,
ChargeBackId = chargeBack_new.Id,
CardBillId = cardBill_new.Id
ChargeBackId = chargeBackId,
CardBillId = cardBillId
});
}
}
else
{
@ -798,7 +799,7 @@ namespace Shentun.Peis.RegisterAsbitems
{
BackMoeny = item.BackMoeny,
PayModeId = item.PayModeId,
ChargeBackId = chargeBack_new.Id
ChargeBackId = chargeBackId
});
}

2
src/Shentun.Peis.Domain/CardBills/CardBillManager.cs

@ -38,7 +38,7 @@ namespace Shentun.Peis.CardBills
DataHelper.CheckStringIsNull(entity.PayModeId, "支付方式");
DataHelper.CheckDecimalIsGeaterThanZero(entity.BillMoney, "记账金额");
return new CardBill(GuidGenerator.Create())
return new CardBill(entity.Id)
{
BillFlag = entity.BillFlag,
BillMoney = entity.BillMoney,

2
src/Shentun.Peis.Domain/ChargeBackPays/ChargeBackPay.cs

@ -11,7 +11,7 @@ namespace Shentun.Peis.Models
/// 退费支付方式
/// </summary>
[Table("charge_back_pay")]
[Index(nameof(ChargeBackId), nameof(PayModeId), Name = "IX_charge_back_pay_pay_mode_id")]
[Index(nameof(ChargeBackId), nameof(PayModeId), Name = "IX_charge_back_pay_pay_mode_id", IsUnique = true)]
public class ChargeBackPay : Entity<Guid>, IHasConcurrencyStamp
{

9
src/Shentun.Peis.Domain/ChargeBacks/ChargeBack.cs

@ -14,10 +14,17 @@ namespace Shentun.Peis.Models
[Table("charge_back")]
public class ChargeBack : AuditedEntity<Guid>, IHasConcurrencyStamp
{
public ChargeBack(Guid id) : base(id)
{
ChargeBackPays = new HashSet<ChargeBackPay>();
ChargeBackAsbitems = new HashSet<ChargeBackAsbitem>();
}
public ChargeBack()
{
ChargeBackPays = new HashSet<ChargeBackPay>();
ChargeBackAsbitems=new HashSet<ChargeBackAsbitem>();
ChargeBackAsbitems = new HashSet<ChargeBackAsbitem>();
}

Loading…
Cancel
Save