ForeignReceivablesRepository.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. using AutoMapper;
  2. using OASystem.Domain;
  3. using OASystem.Domain.Dtos.Groups;
  4. using OASystem.Domain.Entities.Financial;
  5. using OASystem.Domain.ViewModels.Financial;
  6. using OASystem.Infrastructure.Repositories.Groups;
  7. using OASystem.Infrastructure.Repositories.System;
  8. using SqlSugar;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Linq;
  12. using System.Text;
  13. using System.Threading.Tasks;
  14. namespace OASystem.Infrastructure.Repositories.Financial
  15. {
  16. /// <summary>
  17. /// 财务 - 团组应收款项 仓库
  18. /// 雷怡 2023.08.16 15:03
  19. /// </summary>
  20. public class ForeignReceivablesRepository : BaseRepository<Fin_ForeignReceivables, Fin_ForeignReceivablesView>
  21. {
  22. private readonly IMapper _mapper;
  23. private readonly DelegationInfoRepository _delegationRep;
  24. private readonly SetDataRepository _setDataRep;
  25. public ForeignReceivablesRepository(SqlSugarClient sqlSugar, IMapper mapper, DelegationInfoRepository delegationRep, SetDataRepository setDataRep)
  26. : base(sqlSugar)
  27. {
  28. _mapper = mapper;
  29. _delegationRep = delegationRep;
  30. _setDataRep = setDataRep;
  31. }
  32. /// <summary>
  33. /// 收款账单 数据源
  34. /// </summary>
  35. /// <returns></returns>
  36. public async Task<Result> GetDataSource()
  37. {
  38. Result result = new() { Code = -2 };
  39. var groupNameData = await _delegationRep.GetGroupNameList(new GroupNameDto());
  40. var currencyData = await _setDataRep.GetSetDataBySTId(_setDataRep,66); //币种
  41. var remittanceMethodData = await _setDataRep.GetSetDataBySTId(_setDataRep, 14); //汇款方式
  42. result.Code = 0;
  43. result.Msg = "成功!";
  44. result.Data = new {
  45. GroupNameData= groupNameData.Data,
  46. CurrencyData = currencyData.Data,
  47. RemittanceMethodData = remittanceMethodData.Data
  48. };
  49. return result;
  50. }
  51. /// <summary>
  52. /// 根据diid查询团组应收款项
  53. /// </summary>
  54. /// <param name="diid"></param>
  55. /// <returns></returns>
  56. public async Task<Result> GetGroupReceivablesByDiid(int diid)
  57. {
  58. Result result = new() { Code = -2 };
  59. string sql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", diid);
  60. var groupReceivedList = await _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql).ToListAsync();
  61. result.Code = 0;
  62. result.Msg = "查询成功!";
  63. result.Data = groupReceivedList;
  64. return result;
  65. }
  66. /// <summary>
  67. /// 根据diid 数组 查询团组应收款项
  68. /// </summary>
  69. /// <param name="diid"></param>
  70. /// <returns></returns>
  71. public async Task<Result> GetGroupReceivablesByDiids(int[] diids)
  72. {
  73. Result result = new() { Code = -2 };
  74. //string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diids);
  75. var groupReceivedList = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
  76. .Where(pr => pr.IsDel == 0 && diids.Contains(pr.Diid)).ToListAsync();
  77. result.Code = 0;
  78. result.Msg = "查询成功!";
  79. result.Data = groupReceivedList;
  80. return result;
  81. }
  82. }
  83. }