|
@@ -24,11 +24,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
{
|
|
{
|
|
private readonly IMapper _mapper;
|
|
private readonly IMapper _mapper;
|
|
private readonly Result _result;
|
|
private readonly Result _result;
|
|
- public HotelPriceRepository(SqlSugarClient sqlSugar, IMapper mapper) :
|
|
|
|
|
|
+ private readonly TeamRateRepository _teamRateRep;
|
|
|
|
+ public HotelPriceRepository(SqlSugarClient sqlSugar, IMapper mapper, TeamRateRepository teamRateRep) :
|
|
base(sqlSugar)
|
|
base(sqlSugar)
|
|
{
|
|
{
|
|
this._mapper = mapper;
|
|
this._mapper = mapper;
|
|
_result = new Result() { Code = -1, Msg = "操作失败!" };
|
|
_result = new Result() { Code = -1, Msg = "操作失败!" };
|
|
|
|
+ _teamRateRep = teamRateRep;
|
|
}
|
|
}
|
|
|
|
|
|
#region 保留
|
|
#region 保留
|
|
@@ -703,7 +705,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
- /// 酒店预定费用
|
|
|
|
|
|
+ /// 酒店预定
|
|
/// Items By DiId
|
|
/// Items By DiId
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="dto"></param>
|
|
/// <param name="dto"></param>
|
|
@@ -806,6 +808,42 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
return _result;
|
|
return _result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// 酒店预定
|
|
|
|
+ /// 创建 入住卷号码
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="DiId"></param>
|
|
|
|
+ /// <returns></returns>
|
|
|
|
+ public async Task<Result> _CreateCheckVolumeNo(int DiId)
|
|
|
|
+ {
|
|
|
|
+ var groupInfo = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(it => it.Id == DiId && it.IsDel == 0).FirstAsync();
|
|
|
|
+ if (groupInfo != null)
|
|
|
|
+ {
|
|
|
|
+ if (!string.IsNullOrEmpty(groupInfo.VisitCountry))
|
|
|
|
+ {
|
|
|
|
+ string no = string.Empty;
|
|
|
|
+
|
|
|
|
+ string[] countrys = new string[] { };
|
|
|
|
+ countrys = groupInfo.VisitCountry.Split('|');
|
|
|
|
+ foreach (string country in countrys)
|
|
|
|
+ {
|
|
|
|
+ //国家城市三字码 未挪数据 暂时用随机数代替
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ no = CommonFun.GetRandomLetter(countrys.Length).ToUpper();
|
|
|
|
+
|
|
|
|
+ no += CommonFun.GetRandomNumber(2);
|
|
|
|
+
|
|
|
|
+ _result.Code = 0;
|
|
|
|
+ _result.Data = no;
|
|
|
|
+ _result.Msg = "入住卷号码 获取成功!";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 酒店预定
|
|
/// 酒店预定
|
|
/// details
|
|
/// details
|
|
@@ -866,6 +904,72 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
#region 参数处理
|
|
#region 参数处理
|
|
_HotelReservations = _mapper.Map<Grp_HotelReservations>(_dto);
|
|
_HotelReservations = _mapper.Map<Grp_HotelReservations>(_dto);
|
|
_CreditCardPayment = _mapper.Map<Grp_CreditCardPayment>(_dto);
|
|
_CreditCardPayment = _mapper.Map<Grp_CreditCardPayment>(_dto);
|
|
|
|
+
|
|
|
|
+ _HotelReservations.DiId = _dto.DiId;
|
|
|
|
+ _HotelReservations.CreateUserId = _dto.UserId;
|
|
|
|
+ _HotelReservations.Remark = _dto.HotelRemark;
|
|
|
|
+
|
|
|
|
+ #region CCP 表参数
|
|
|
|
+ _CreditCardPayment.CreateUserId = _dto.UserId;
|
|
|
|
+ _CreditCardPayment.DIId = _dto.DiId;
|
|
|
|
+ _CreditCardPayment.CTable = 76;
|
|
|
|
+ _CreditCardPayment.PayPercentage = 100.00M;
|
|
|
|
+ _CreditCardPayment.PayThenMoney = _CreditCardPayment.PayMoney;
|
|
|
|
+
|
|
|
|
+ string paymentCurrencyCode = string.Empty;
|
|
|
|
+ List<Sys_SetData> currencySouruce = await _sqlSugar.Queryable<Sys_SetData>().Where(a => a.IsDel == 0 && a.STid == 66).ToListAsync();
|
|
|
|
+ if (currencySouruce.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ Sys_SetData currency = new Sys_SetData();
|
|
|
|
+ currency = currencySouruce.Where(it => it.Id == _CreditCardPayment.PaymentCurrency).FirstOrDefault();
|
|
|
|
+ if (currency != null)
|
|
|
|
+ {
|
|
|
|
+ paymentCurrencyCode = currency.Name;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<TeamRateModelView> teamRateModelViews = new List<TeamRateModelView>();
|
|
|
|
+ teamRateModelViews = await _teamRateRep.PostGroupRateInfoByDiId(_dto.DiId);
|
|
|
|
+ if (teamRateModelViews.Count < 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "该团未设置酒店预订模块相关币种汇率!";
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+ TeamRateModelView teamRateModels_hotel = new TeamRateModelView();
|
|
|
|
+ teamRateModels_hotel = teamRateModelViews.Where(it => it.CTableId == 76).FirstOrDefault();
|
|
|
|
+ if (teamRateModels_hotel == null)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "该团未设置酒店预订模块相关币种汇率!";
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<TeamRateDescView> teamRateDescViews = new List<TeamRateDescView>();
|
|
|
|
+ teamRateDescViews = teamRateModels_hotel.TeamRates;
|
|
|
|
+ if (teamRateDescViews.Count < 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "该团未设置酒店预订模块相关币种汇率!";
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+ TeamRateDescView teamRateDescView = new TeamRateDescView();
|
|
|
|
+ teamRateDescView = teamRateDescViews.Where(it => it.CurrencyCode == paymentCurrencyCode).FirstOrDefault();
|
|
|
|
+ if (teamRateDescView == null)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "该团未设置酒店预订模块相关币种汇率!";
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+ _CreditCardPayment.DayRate = teamRateDescView.Rate;
|
|
|
|
+ _CreditCardPayment.RMBPrice = (_CreditCardPayment.DayRate * _CreditCardPayment.PayMoney).DecimalsKeepTwo();
|
|
|
|
+
|
|
|
|
+ if (_CreditCardPayment.PayDId == 72) //刷卡
|
|
|
|
+ {
|
|
|
|
+ _CreditCardPayment.BankNo = "6222 **** **** 7990";
|
|
|
|
+ _CreditCardPayment.CardholderName = "Zhang Hailin";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ _CreditCardPayment.Remark = _dto.CcpRemark;
|
|
|
|
+ #endregion
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
if (_dto.Id == 0) // Add
|
|
if (_dto.Id == 0) // Add
|
|
@@ -890,6 +994,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
return _result;
|
|
return _result;
|
|
}
|
|
}
|
|
_result.Msg = "操作成功!";
|
|
_result.Msg = "操作成功!";
|
|
|
|
+ _result.Code = 0;
|
|
_sqlSugar.CommitTran(); // 提交
|
|
_sqlSugar.CommitTran(); // 提交
|
|
}
|
|
}
|
|
else if (_dto.Id > 0) //Edit
|
|
else if (_dto.Id > 0) //Edit
|
|
@@ -910,17 +1015,83 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
it.GuestName,
|
|
it.GuestName,
|
|
it.CheckInDate,
|
|
it.CheckInDate,
|
|
it.CheckOutDate,
|
|
it.CheckOutDate,
|
|
-
|
|
|
|
|
|
+ it.CheckType,
|
|
|
|
+ it.RoomExplanation,
|
|
|
|
+ it.SingleRoomPrice,
|
|
|
|
+ it.SingleRoomCount,
|
|
|
|
+ it.DoubleRoomPrice,
|
|
|
|
+ it.DoubleRoomCount,
|
|
|
|
+ it.SuiteRoomPrice,
|
|
|
|
+ it.SuiteRoomCount,
|
|
|
|
+ it.OtherRoomPrice,
|
|
|
|
+ it.OtherRoomCount,
|
|
|
|
+ it.CardPrice,
|
|
|
|
+ it.CardPriceCurrency,
|
|
|
|
+ it.Isoppay,
|
|
|
|
+ it.BreakfastPrice,
|
|
|
|
+ it.BreakfastCurrency,
|
|
|
|
+ it.GovernmentRent,
|
|
|
|
+ it.GovernmentRentCurrency,
|
|
|
|
+ it.CityTax,
|
|
|
|
+ it.CityTaxCurrency,
|
|
|
|
+ it.Remark,
|
|
})
|
|
})
|
|
.WhereColumns(it => it.Id)
|
|
.WhereColumns(it => it.Id)
|
|
.ExecuteCommandAsync();
|
|
.ExecuteCommandAsync();
|
|
|
|
|
|
- var hotelInfo = await _sqlSugar.Queryable<Grp_HotelReservations>().FirstAsync();
|
|
|
|
|
|
+ if (hotelStatus < 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "酒店预定信息修改失败!";
|
|
|
|
+ _sqlSugar.RollbackTran(); //回滚
|
|
|
|
+ return _result;
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ var hotelInfo = await _sqlSugar.Queryable<Grp_CreditCardPayment>()
|
|
|
|
+ .Where(it => it.DIId == _dto.DiId && it.CId == _dto.Id && it.CTable == 76 && it.IsDel == 0)
|
|
|
|
+ .FirstAsync();
|
|
|
|
+ if (hotelInfo == null) //ccp表 Add
|
|
|
|
+ {
|
|
|
|
|
|
- _sqlSugar.CommitTran();
|
|
|
|
- _sqlSugar.RollbackTran();
|
|
|
|
|
|
+ }
|
|
|
|
+ else //ccp表 Edit
|
|
|
|
+ {
|
|
|
|
+ _CreditCardPayment.Id = hotelInfo.Id;
|
|
|
|
+
|
|
|
|
+ int creditCardStatus = await _sqlSugar.Updateable<Grp_CreditCardPayment>(_CreditCardPayment)
|
|
|
|
+ .UpdateColumns(it => new
|
|
|
|
+ {
|
|
|
|
+ it.PayDId,
|
|
|
|
+ it.ConsumptionPatterns,
|
|
|
|
+ it.ConsumptionDate,
|
|
|
|
+ it.PayMoney,
|
|
|
|
+ it.PaymentCurrency,
|
|
|
|
+ it.PayThenMoney,
|
|
|
|
+ it.DayRate,
|
|
|
|
+ it.RMBPrice,
|
|
|
|
+ it.BankNo,
|
|
|
|
+ it.CardholderName,
|
|
|
|
+ it.OtherBankName,
|
|
|
|
+ it.OtherSideNo,
|
|
|
|
+ it.OtherSideName,
|
|
|
|
+ it.Payee,
|
|
|
|
+ it.OrbitalPrivateTransfer,
|
|
|
|
+ it.Remark,
|
|
|
|
+ })
|
|
|
|
+ .WhereColumns(it => it.Id)
|
|
|
|
+ .ExecuteCommandAsync();
|
|
|
|
+ if (creditCardStatus < 0)
|
|
|
|
+ {
|
|
|
|
+ _result.Msg = "付款信息表修改失败!";
|
|
|
|
+ _sqlSugar.RollbackTran(); //回滚
|
|
|
|
+ return _result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _result.Msg = "操作成功!";
|
|
|
|
+ _result.Code = 0;
|
|
|
|
+ _sqlSugar.CommitTran(); // 提交
|
|
}
|
|
}
|
|
else if (_dto.Id < 0) //不正确的Id
|
|
else if (_dto.Id < 0) //不正确的Id
|
|
{
|
|
{
|