|  | @@ -4,6 +4,7 @@ using OASystem.Domain.Dtos.Groups;
 | 
												
													
														
															|  |  using OASystem.Domain.Entities.Financial;
 |  |  using OASystem.Domain.Entities.Financial;
 | 
												
													
														
															|  |  using OASystem.Domain.Entities.Groups;
 |  |  using OASystem.Domain.Entities.Groups;
 | 
												
													
														
															|  |  using OASystem.Domain.Entities.Resource;
 |  |  using OASystem.Domain.Entities.Resource;
 | 
												
													
														
															|  | 
 |  | +using OASystem.Domain.ViewModels.Financial;
 | 
												
													
														
															|  |  using OASystem.Domain.ViewModels.Groups;
 |  |  using OASystem.Domain.ViewModels.Groups;
 | 
												
													
														
															|  |  using OASystem.Domain.ViewModels.QiYeWeChat;
 |  |  using OASystem.Domain.ViewModels.QiYeWeChat;
 | 
												
													
														
															|  |  using OASystem.Domain.ViewModels.Resource;
 |  |  using OASystem.Domain.ViewModels.Resource;
 | 
												
											
												
													
														
															|  | @@ -20,9 +21,12 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |      public class DecreasePaymentsRepository : BaseRepository<Grp_DecreasePayments, Grp_DecreasePayments>
 |  |      public class DecreasePaymentsRepository : BaseRepository<Grp_DecreasePayments, Grp_DecreasePayments>
 | 
												
													
														
															|  |      {
 |  |      {
 | 
												
													
														
															|  |          private readonly IMapper _mapper;
 |  |          private readonly IMapper _mapper;
 | 
												
													
														
															|  | -        public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
 |  | 
 | 
												
													
														
															|  | 
 |  | +        private readonly TeamRateRepository _teamRateRep;
 | 
												
													
														
															|  | 
 |  | +        public DecreasePaymentsRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep) 
 | 
												
													
														
															|  | 
 |  | +            : base(sqlSugar)
 | 
												
													
														
															|  |          {
 |  |          {
 | 
												
													
														
															|  |              this._mapper = mapper;
 |  |              this._mapper = mapper;
 | 
												
													
														
															|  | 
 |  | +            _teamRateRep = teamRateRep;
 | 
												
													
														
															|  |          }
 |  |          }
 | 
												
													
														
															|  |          /// <summary>
 |  |          /// <summary>
 | 
												
													
														
															|  |          /// 根据团组Id查询数据
 |  |          /// 根据团组Id查询数据
 | 
												
											
												
													
														
															|  | @@ -123,6 +127,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |              {
 |  |              {
 | 
												
													
														
															|  |                  int id = 0;
 |  |                  int id = 0;
 | 
												
													
														
															|  |                  Grp_DecreasePayments grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
 |  |                  Grp_DecreasePayments grp_Decrease = _mapper.Map<Grp_DecreasePayments>(dto);
 | 
												
													
														
															|  | 
 |  | +                List<TeamRateDescAddCurrencyIdView> teamRates = await _teamRateRep.PostGroupTeamRateItemByDiIdAndCTableId(1, dto.DiId, 98);
 | 
												
													
														
															|  |                  if (dto.Status == 1)//添加
 |  |                  if (dto.Status == 1)//添加
 | 
												
													
														
															|  |                  {
 |  |                  {
 | 
												
													
														
															|  |                      string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
 |  |                      string selectSql = string.Format(@"select * from Grp_DecreasePayments where PriceName='{0}' and IsDel={1} and DiId={2}"
 | 
												
											
												
													
														
															|  | @@ -130,13 +135,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |                      var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
 |  |                      var DecreasePayments = await _sqlSugar.SqlQueryable<Grp_DecreasePayments>(selectSql).FirstAsync();//查询是否存在
 | 
												
													
														
															|  |                      if (DecreasePayments != null)
 |  |                      if (DecreasePayments != null)
 | 
												
													
														
															|  |                      {
 |  |                      {
 | 
												
													
														
															|  | -                        return result = new Result() { Code = -1, Msg = "该客户已存在,请勿重复添加!" };
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
 | 
												
													
														
															|  |                      }
 |  |                      }
 | 
												
													
														
															|  |                      else//不存在,可添加
 |  |                      else//不存在,可添加
 | 
												
													
														
															|  |                      {
 |  |                      {
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                          id = await AddAsyncReturnId(grp_Decrease);
 |  |                          id = await AddAsyncReturnId(grp_Decrease);
 | 
												
													
														
															|  | -                        if (id != 0)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                        if (id > 0)
 | 
												
													
														
															|  |                          {
 |  |                          {
 | 
												
													
														
															|  |                              result = new Result() { Code = 0, Msg = "添加成功!" };
 |  |                              result = new Result() { Code = 0, Msg = "添加成功!" };
 | 
												
													
														
															|  |                          }
 |  |                          }
 | 
												
											
												
													
														
															|  | @@ -182,7 +187,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |                              C.DIId = grp_Decrease.DiId;
 |  |                              C.DIId = grp_Decrease.DiId;
 | 
												
													
														
															|  |                              C.CId = id;
 |  |                              C.CId = id;
 | 
												
													
														
															|  |                              C.CTable = 98;
 |  |                              C.CTable = 98;
 | 
												
													
														
															|  | -                            C.PayPercentage = 0;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                            C.PayPercentage = 100;
 | 
												
													
														
															|  |                              C.PayThenMoney = 0;
 |  |                              C.PayThenMoney = 0;
 | 
												
													
														
															|  |                              C.PayPercentageOld = 0;
 |  |                              C.PayPercentageOld = 0;
 | 
												
													
														
															|  |                              C.PayThenMoneyOld = 0;
 |  |                              C.PayThenMoneyOld = 0;
 | 
												
											
												
													
														
															|  | @@ -193,30 +198,24 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |                              //C.RMBPrice = 0.00f;
 |  |                              //C.RMBPrice = 0.00f;
 | 
												
													
														
															|  |  
 |  |  
 | 
												
													
														
															|  |                              //设置该团组的汇率
 |  |                              //设置该团组的汇率
 | 
												
													
														
															|  | -                            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
 |  | 
 | 
												
													
														
															|  | -                            if (_TeamRate != null)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                            TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).FirstOrDefault();
 | 
												
													
														
															|  | 
 |  | +                            //Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
 | 
												
													
														
															|  | 
 |  | +                            if (teamRate != null)
 | 
												
													
														
															|  |                              {
 |  |                              {
 | 
												
													
														
															|  | -                                if (grp_Decrease.Currency == 49)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                if (teamRate.CurrencyCode.Equals("CNY"))
 | 
												
													
														
															|  |                                  {
 |  |                                  {
 | 
												
													
														
															|  | -                                    C.DayRate = _TeamRate.RateU;
 |  | 
 | 
												
													
														
															|  | -                                    C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateU);
 |  | 
 | 
												
													
														
															|  | -                                    //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateU); 
 |  | 
 | 
												
													
														
															|  | -                                }
 |  | 
 | 
												
													
														
															|  | -                                else if (grp_Decrease.Currency == 51)
 |  | 
 | 
												
													
														
															|  | -                                {
 |  | 
 | 
												
													
														
															|  | -                                    C.DayRate = _TeamRate.RateE;
 |  | 
 | 
												
													
														
															|  | -                                    C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateE);
 |  | 
 | 
												
													
														
															|  | -                                    //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateE); 
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                    C.DayRate = 1.0000M;
 | 
												
													
														
															|  | 
 |  | +                                    C.RMBPrice = C.PayMoney;
 | 
												
													
														
															|  |                                  }
 |  |                                  }
 | 
												
													
														
															|  |                                  else
 |  |                                  else
 | 
												
													
														
															|  |                                  {
 |  |                                  {
 | 
												
													
														
															|  | -                                    C.DayRate = 1M;
 |  | 
 | 
												
													
														
															|  | -                                    C.RMBPrice = C.PayMoney;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                    C.DayRate = teamRate.Rate;
 | 
												
													
														
															|  | 
 |  | +                                    C.RMBPrice = C.PayMoney * C.DayRate;
 | 
												
													
														
															|  |                                  }
 |  |                                  }
 | 
												
													
														
															|  |                              }
 |  |                              }
 | 
												
													
														
															|  |                              else
 |  |                              else
 | 
												
													
														
															|  |                              {
 |  |                              {
 | 
												
													
														
															|  | -                                C.DayRate = 1M;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                C.DayRate = 1.0000M;
 | 
												
													
														
															|  |                                  C.RMBPrice = C.PayMoney;
 |  |                                  C.RMBPrice = C.PayMoney;
 | 
												
													
														
															|  |                              }
 |  |                              }
 | 
												
													
														
															|  |                              int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
 |  |                              int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
 | 
												
											
												
													
														
															|  | @@ -253,27 +252,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
 | 
												
													
														
															|  |                          Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable==98 && a.CId==grp_Decrease.Id && a.IsDel == 0);
 |  |                          Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Decrease.Id && a.CTable==98 && a.CId==grp_Decrease.Id && a.IsDel == 0);
 | 
												
													
														
															|  |                          if (grp_CreditCardPayment != null)
 |  |                          if (grp_CreditCardPayment != null)
 | 
												
													
														
															|  |                          {
 |  |                          {
 | 
												
													
														
															|  | -                            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Decrease.DiId && a.IsDel == 0 && a.CTable == 98);
 |  | 
 | 
												
													
														
															|  | -                            if (_TeamRate != null)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                            //设置该团组的汇率
 | 
												
													
														
															|  | 
 |  | +                            TeamRateDescAddCurrencyIdView teamRate = teamRates.Where(it => it.CurrencyCode == grp_Decrease.Currency.ToString()).FirstOrDefault();
 | 
												
													
														
															|  | 
 |  | +                            
 | 
												
													
														
															|  | 
 |  | +                            if (teamRate != null)
 | 
												
													
														
															|  |                              {
 |  |                              {
 | 
												
													
														
															|  | -
 |  | 
 | 
												
													
														
															|  | -                                if (grp_Decrease.Currency == 49)
 |  | 
 | 
												
													
														
															|  | -                                {
 |  | 
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.DayRate = _TeamRate.RateU;
 |  | 
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.RMBPrice = grp_Decrease.Price * Convert.ToDecimal(_TeamRate.RateU);
 |  | 
 | 
												
													
														
															|  | -                                    //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateU); 
 |  | 
 | 
												
													
														
															|  | -                                }
 |  | 
 | 
												
													
														
															|  | -                                else if (grp_Decrease.Currency == 51)
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                if (teamRate.CurrencyCode.Equals("CNY"))
 | 
												
													
														
															|  |                                  {
 |  |                                  {
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.DayRate = _TeamRate.RateE;
 |  | 
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.RMBPrice = grp_Decrease.Price * Convert.ToDecimal(_TeamRate.RateE);
 |  | 
 | 
												
													
														
															|  | -                                    //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateE); 
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                   grp_CreditCardPayment.DayRate = 1.0000M;
 | 
												
													
														
															|  | 
 |  | +                                    grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney;
 | 
												
													
														
															|  |                                  }
 |  |                                  }
 | 
												
													
														
															|  |                                  else
 |  |                                  else
 | 
												
													
														
															|  |                                  {
 |  |                                  {
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.DayRate = 1M;
 |  | 
 | 
												
													
														
															|  | -                                    grp_CreditCardPayment.RMBPrice = grp_Decrease.Price;
 |  | 
 | 
												
													
														
															|  | 
 |  | +                                    grp_CreditCardPayment.DayRate = teamRate.Rate;
 | 
												
													
														
															|  | 
 |  | +                                    grp_CreditCardPayment.RMBPrice = grp_CreditCardPayment.PayMoney * grp_CreditCardPayment.DayRate;
 | 
												
													
														
															|  |                                  }
 |  |                                  }
 | 
												
													
														
															|  | 
 |  | +
 | 
												
													
														
															|  |                              }
 |  |                              }
 | 
												
													
														
															|  |                              else
 |  |                              else
 | 
												
													
														
															|  |                              {
 |  |                              {
 |