CreditCardPaymentRepository.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. using AutoMapper;
  2. using OASystem.Domain;
  3. using OASystem.Domain.Entities.Groups;
  4. using OASystem.Domain.ViewModels.Financial;
  5. using OASystem.Domain.ViewModels.Groups;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace OASystem.Infrastructure.Repositories.Financial
  12. {
  13. /// <summary>
  14. /// 财务 - 付款信息类
  15. /// 雷怡 2023.08.16 16:19
  16. /// </summary>
  17. public class CreditCardPaymentRepository : BaseRepository<Grp_CreditCardPayment, Grp_Fin_CreditCardPaymentView>
  18. {
  19. private readonly IMapper _mapper;
  20. public CreditCardPaymentRepository(SqlSugarClient sqlSugar, IMapper mapper)
  21. : base(sqlSugar)
  22. {
  23. _mapper = mapper;
  24. }
  25. /// <summary>
  26. /// 根据diid查询团组付款信息
  27. /// </summary>
  28. /// <param name="diid"></param>
  29. /// <param name="isPay">false 未支付 true 已支付</param>
  30. /// <returns></returns>
  31. public async Task<Result> GetGroupPaymentInfoByDiid(int diid,bool isPay)
  32. {
  33. Result result = new() { Code = -2 };
  34. int _isPay = 0;
  35. if (isPay) { _isPay = 1; }
  36. string sql = string.Format(@"Select * From Grp_CreditCardPayment Where IsDel=0 And Diid={0} And IsPay={1}", diid, _isPay);
  37. var groupReceivablesList = await _sqlSugar.SqlQueryable<Fin_ProceedsReceivedView>(sql).ToListAsync();
  38. result.Code = 0;
  39. result.Msg = "查询成功!";
  40. result.Data = groupReceivablesList;
  41. return result;
  42. }
  43. /// <summary>
  44. /// 团组 其他款项/退款
  45. /// </summary>
  46. /// <param name="diid">团组Id</param>
  47. /// <param name="isPay"></param>
  48. /// <returns></returns>
  49. public async Task<Result> GetGroupRefundByDiid(int diid, bool isPay)
  50. {
  51. Result result = new() { Code = -2 };
  52. int _isPay = 0;
  53. if (isPay) { _isPay = 1; }
  54. string sql = string.Format(@"Select ccp.CreateUserId,ccp.AuditGMDate,sd1.name As PayType,ccp.OrbitalPrivateTransfer,ccp.PayDid,
  55. ccp.payee,ccp.IsPay,gdp.CreateTime,gdp.PriceName,gdp.Price,sd.[Name] Currency,
  56. ccp.PayMoney As Spread,ccp.DayRate,gdp.Remark From Fin_OtherPrice gdp
  57. join Grp_CreditCardPayment ccp On ccp.Diid = gdp.Diid and ccp.Cid = gdp.Id
  58. join Sys_SetData sd On sd.Id =gdp.CurrencyId
  59. join Sys_SetData sd1 On sd1.id=ccp.PayDid
  60. Where ccp.DIId={0} And gdp.IsDel = 0 and ccp.isDel=0 and ccp.CTable=285 and ccp.IsPay = {1} ", diid, _isPay);
  61. var groupRefundList = await _sqlSugar.SqlQueryable<GroupRefundView>(sql).ToListAsync();
  62. result.Code = 0;
  63. result.Msg = "查询成功!";
  64. result.Data = groupRefundList;
  65. return result;
  66. }
  67. }
  68. }