123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using AutoMapper;
- using OASystem.Domain;
- using OASystem.Domain.Dtos.Financial;
- using OASystem.Domain.Dtos.Groups;
- using OASystem.Domain.Entities.Financial;
- using OASystem.Domain.ViewModels.Financial;
- using OASystem.Infrastructure.Repositories.Groups;
- using OASystem.Infrastructure.Repositories.System;
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Infrastructure.Repositories.Financial
- {
- /// <summary>
- /// 财务 - 团组应收款项 仓库
- /// 雷怡 2023.08.16 15:03
- /// </summary>
- public class ForeignReceivablesRepository : BaseRepository<Fin_ForeignReceivables, Fin_ForeignReceivablesView>
- {
- private readonly IMapper _mapper;
- private readonly DelegationInfoRepository _delegationRep;
- private readonly SetDataRepository _setDataRep;
- public ForeignReceivablesRepository(SqlSugarClient sqlSugar, IMapper mapper, DelegationInfoRepository delegationRep, SetDataRepository setDataRep)
- : base(sqlSugar)
- {
- _mapper = mapper;
- _delegationRep = delegationRep;
- _setDataRep = setDataRep;
- }
- /// <summary>
- /// 收款账单 数据源
- /// </summary>
- /// <returns></returns>
- public async Task<Result> GetDataSource()
- {
- Result result = new() { Code = -2 };
- var groupNameData = await _delegationRep.GetGroupNameList(new GroupNameDto());
- var currencyData = await _setDataRep.GetSetDataBySTId(_setDataRep,13); //币种
- var remittanceMethodData = await _setDataRep.GetSetDataBySTId(_setDataRep, 14); //汇款方式
- result.Code = 0;
- result.Msg = "成功!";
- result.Data = new {
- GroupNameData= groupNameData.Data,
- CurrencyData = currencyData.Data,
- RemittanceMethodData = remittanceMethodData.Data
- };
- return result;
- }
- /// <summary>
- /// 根据diid查询团组应收款项
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public async Task<Result> GetGroupReceivablesInfoByDiId(ForForeignReceivablesInfoDto dto)
- {
- Result result = new() { Code = -2 };
- var groupInfoData = await _delegationRep.GetGroupInfo(new GroupInfoDto() { Id = dto.DiId });
- //应收款项
- string groupReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
- var groupReceivedList = await _sqlSugar.SqlQueryable<ForeignReceivablesInfoView>(groupReceivedSql).ToListAsync();
- //已收款项
- string groupProceedsReceivedSql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", dto.DiId);
- var groupProceedsReceivedList = await _sqlSugar.SqlQueryable<ForeignReceivablesInfoView>(groupReceivedSql).ToListAsync();
- if (dto.PortType == 1 )
- {
- }
- result.Code = 0;
- result.Msg = "查询成功!";
- result.Data = new
- {
- GroupInfo = groupInfoData.Data,
- GroupReceivedData = groupReceivedList
- };
- return result;
- }
- /// <summary>
- /// 根据diid查询团组应收款项
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public async Task<Result> GetGroupReceivablesByDiid(int diid)
- {
- Result result = new() { Code = -2 };
- string sql = string.Format(@"Select * From Fin_ForeignReceivables Where IsDel=0 And Diid={0}", diid);
- var groupReceivedList = await _sqlSugar.SqlQueryable<Fin_ForeignReceivables>(sql).ToListAsync();
- result.Code = 0;
- result.Msg = "查询成功!";
- result.Data = groupReceivedList;
- return result;
- }
- /// <summary>
- /// 根据diid 数组 查询团组应收款项
- /// </summary>
- /// <param name="diid"></param>
- /// <returns></returns>
- public async Task<Result> GetGroupReceivablesByDiids(int[] diids)
- {
- Result result = new() { Code = -2 };
- //string sql = string.Format(@"Select * From Fin_ProceedsReceived Where IsDel=0 And Diid={0}", diids);
- var groupReceivedList = await _sqlSugar.Queryable<Fin_ForeignReceivables>()
- .Where(pr => pr.IsDel == 0 && diids.Contains(pr.Diid)).ToListAsync();
- result.Code = 0;
- result.Msg = "查询成功!";
- result.Data = groupReceivedList;
- return result;
- }
- }
- }
|