ForeignReceivablesRepository.cs 4.4 KB

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