using AutoMapper;
using OASystem.Domain;
using OASystem.Domain.Entities.Groups;
using OASystem.Domain.ViewModels.Financial;
using OASystem.Domain.ViewModels.Groups;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OASystem.Infrastructure.Repositories.Financial
{
///
/// 财务 - 付款信息类
/// 雷怡 2023.08.16 16:19
///
public class CreditCardPaymentRepository : BaseRepository
{
private readonly IMapper _mapper;
public CreditCardPaymentRepository(SqlSugarClient sqlSugar, IMapper mapper)
: base(sqlSugar)
{
_mapper = mapper;
}
///
/// 根据diid查询团组付款信息
///
///
/// false 未支付 true 已支付
///
public async Task GetGroupPaymentInfoByDiid(int diid,bool isPay)
{
Result result = new() { Code = -2 };
int _isPay = 0;
if (isPay) { _isPay = 1; }
string sql = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel=0 And Diid={0} And IsPay={1}", diid, _isPay);
var groupReceivablesList = await _sqlSugar.SqlQueryable(sql).ToListAsync();
result.Code = 0;
result.Msg = "查询成功!";
result.Data = groupReceivablesList;
return result;
}
///
/// 团组 其他款项/退款
///
/// 团组Id
///
///
public async Task GetGroupRefundByDiid(int diid, bool isPay)
{
Result result = new() { Code = -2 };
int _isPay = 0;
if (isPay) { _isPay = 1; }
string sql = string.Format(@"Select ccp.CreateUserId,ccp.AuditGMDate,sd1.name As PayType,ccp.OrbitalPrivateTransfer,ccp.PayDid,
ccp.payee,ccp.IsPay,gdp.CreateTime,gdp.PriceName,gdp.Price,sd.[Name] Currency,
ccp.PayMoney As Spread,ccp.DayRate,gdp.Remark From Fin_OtherPrice gdp
join Grp_CreditCardPayment ccp On ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id
join Sys_SetData sd On sd.Id =gdp.CurrencyId
join Sys_SetData sd1 On sd1.id=ccp.PayDid
Where ccp.DIId={0} And gdp.IsDel = 0 and ccp.isDel=0 and ccp.CTable=285 and ccp.IsPay = {1} ", diid, _isPay);
var groupRefundList = await _sqlSugar.SqlQueryable(sql).ToListAsync();
result.Code = 0;
result.Msg = "查询成功!";
result.Data = groupRefundList;
return result;
}
}
}