Browse Source

酒店接口编写

wangh 1 year ago
parent
commit
3fc748d09a

+ 29 - 0
OASystem/OASystem.Api/Controllers/BusinessController.cs

@@ -102,6 +102,35 @@ namespace OASystem.API.Controllers
                 throw;
             }
         }
+
+        /// <summary>
+        /// 根据团组Id币种Id及类型Id查询团组汇率
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpGet, HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> PostCurrencyByDiid(int DiId,int CId,int CurrencyId)
+        {
+            try
+            {
+                Result setData = await _setDataRep.PostCurrencyByDiid( DiId, CId, CurrencyId); //币种类型
+                if (setData.Code == 0)
+                {
+                    return Ok(JsonView(true, "查询成功", setData.Data));
+                }
+                else
+                {
+                    return Ok(JsonView(false, setData.Msg));
+                }
+            }
+            catch (Exception)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+
+        }
         #endregion
 
         #region 会务物料单

+ 1 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -140,6 +140,7 @@ namespace OASystem.Domain.AutoMappers
 
             #region 酒店预订
             CreateMap<Grp_HotelReservations, HotelReservationsByIdView>();
+            CreateMap<Grp_CreditCardPayment, Grp_CreditCardView>();
             #endregion
 
             #endregion

+ 0 - 5
OASystem/OASystem.Domain/Dtos/Groups/HotelReservationsDto.cs

@@ -83,10 +83,6 @@ namespace OASystem.Domain.Dtos.Groups
         /// </summary>
         public string CheckOutDate { get; set; }
         /// <summary>
-        /// 预算金额
-        /// </summary>
-        public decimal Budget { get; set; }
-        /// <summary>
         /// 预算币种(设置数据外键编号)
         /// </summary>
         public int BudgetCurrency { get; set; }
@@ -175,7 +171,6 @@ namespace OASystem.Domain.Dtos.Groups
         /// 房间入住人类型
         /// </summary>
         public string CheckType { get; set; }
-        public int MyProperty { get; set; }
         /// <summary>
         /// 创建者Id
         /// </summary>

+ 119 - 9
OASystem/OASystem.Domain/ViewModels/Groups/HotelReservationsByDiIdView.cs

@@ -68,7 +68,6 @@ namespace OASystem.Domain.ViewModels.Groups
     /// <summary>
     /// 根据id查询酒店费用详情返回view
     /// </summary>
-
     public class HotelReservationsByIdView
     {
         public int Id { get; set; }
@@ -80,6 +79,11 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 客人类型(设置数据外键编号)
         /// </summary>
         public int GTId { get; set; }
+
+        /// <summary>
+        /// 客人类型文本
+        /// </summary>
+        public string GtIdStr { get; set; }
         /// <summary>
         /// 入住卷号码
         /// </summary>
@@ -117,21 +121,21 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public string GuestName { get; set; }
         /// <summary>
-        /// 入住日期
+        /// 预算币种(设置数据外键编号)
         /// </summary>
-        public string CheckInDate { get; set; }
+        public int BudgetCurrency { get; set; }
         /// <summary>
-        /// 退房日期
+        /// 预算币种(设置数据外键编号)
         /// </summary>
-        public string CheckOutDate { get; set; }
+        public string BudgetCurrencyStr { get; set; }
         /// <summary>
-        /// 预算金额
+        /// 入住日期
         /// </summary>
-        public decimal Budget { get; set; }
+        public string CheckInDate { get; set; }
         /// <summary>
-        /// 预算币种(设置数据外键编号)
+        /// 退房日期
         /// </summary>
-        public int BudgetCurrency { get; set; }
+        public string CheckOutDate { get; set; }
         /// <summary>
         /// 单间数量
         /// </summary>
@@ -206,6 +210,10 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public int GovernmentRentCurrency { get; set; }
         /// <summary>
+        /// 地税币种文本
+        /// </summary>
+        public string GovernmentRentCurrencyStr { get; set; }
+        /// <summary>
         /// 城市税
         /// </summary>
         public decimal CityTax { get; set; }
@@ -214,12 +222,114 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public int CityTaxCurrency { get; set; }
         /// <summary>
+        /// 城市税币种文本
+        /// </summary>
+        public string CityTaxCurrencyStr { get; set; }
+        /// <summary>
         /// 房间入住人类型
         /// </summary>
         public string CheckType { get; set; }
         /// <summary>
+        /// 房间入住人类型文本描述
+        /// </summary>
+        public string CheckTypeStr { get; set; }
+        /// <summary>
         /// 备注
         /// </summary>
         public string Remark { get; set; }
     }
+    /// <summary>
+    /// 根据id查询酒店费用C表的数据
+    /// </summary>
+    public class Grp_CreditCardView
+    {
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public int PayDId { get; set; }
+        /// <summary>
+        /// 支付方式文本
+        /// </summary>
+        public string PayDIdStr { get; set; }
+        /// <summary>
+        /// 消费方式
+        /// </summary>
+        public string ConsumptionPatterns { get; set; }
+        /// <summary>
+        /// 消费日期
+        /// </summary>
+        public string ConsumptionDate { get; set; }
+        /// <summary>
+        /// 卡类型
+        /// </summary>
+        public int CTDId { get; set; }
+        /// <summary>
+        /// 卡类型文本
+        /// </summary>
+        public string CTDIdStr { get; set; }
+
+        /// <summary>
+        /// 银行卡号
+        /// </summary>
+        public string BankNo { get; set; }
+        /// <summary>
+        /// 持卡人姓名
+        /// </summary>
+        public string CardholderName { get; set; }
+        /// <summary>
+        /// 付款金额
+        /// </summary>
+        public decimal PayMoney { get; set; }
+        /// <summary>
+        /// 付款币种 数据类型Id
+        /// </summary>
+        public int PaymentCurrency { get; set; }
+        /// <summary>
+        /// 付款币种 文本
+        /// </summary>
+        public string PaymentCurrencyStr { get; set; }
+        /// <summary>
+        /// 当天汇率
+        /// </summary>
+        public decimal DayRate { get; set; }
+        /// <summary>
+        /// 公司银行卡号
+        /// </summary>
+        public string CompanyBankNo { get; set; }
+        /// <summary>
+        /// 对方开户行
+        /// </summary>
+        public string OtherBankName { get; set; }
+        /// <summary>
+        /// 对方银行账号
+        /// </summary>
+        public string OtherSideNo { get; set; }
+        /// <summary>
+        /// 对方姓名
+        /// </summary>
+        public string OtherSideName { get; set; }
+        
+        /// <summary>
+        /// 总经理是否审核  0 未审核 1已通过 2未通过
+        /// </summary>
+        public int IsAuditGM { get; set; }
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string Payee { get; set; }
+        /// <summary>
+        /// 人民币费用
+        /// </summary>
+        public decimal RMBPrice { get; set; }
+
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+        /// <summary>
+        /// 费用标识文本
+        /// </summary>
+        public int OrbitalPrivateTransferStr { get; set; }
+
+    }
 }

+ 37 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/HotelPriceRepository.cs

@@ -127,7 +127,43 @@ namespace OASystem.Infrastructure.Repositories.Groups
             {
                 Grp_HotelReservations hotelReservationsById = _sqlSugar.Queryable<Grp_HotelReservations>().First(a => a.IsDel == 0 && a.Id == dto.Id);
                 HotelReservationsByIdView _hotelReservations = _mapper.Map<HotelReservationsByIdView>(hotelReservationsById);
-                Grp_CreditCardPayment _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 76);
+                if (_hotelReservations!=null)
+                {
+                    
+                    Sys_SetData GTId = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == hotelReservationsById.GTId);
+                    if (GTId != null) _hotelReservations.GtIdStr = GTId.Name;
+                    
+                    _hotelReservations.CheckInDate=Convert.ToDateTime(hotelReservationsById.CheckInDate).ToString("yyyy-MM-dd");
+                    _hotelReservations.CheckOutDate = Convert.ToDateTime(hotelReservationsById.CheckOutDate).ToString("yyyy-MM-dd");
+
+                    Sys_SetData GovernmentRentCurrencyStr = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == hotelReservationsById.GovernmentRentCurrency);
+                    if (GovernmentRentCurrencyStr != null) _hotelReservations.GovernmentRentCurrencyStr = GovernmentRentCurrencyStr.Name;
+
+                    Sys_SetData CityTaxCurrencyStr = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == hotelReservationsById.CityTaxCurrency);
+                    if (CityTaxCurrencyStr != null) _hotelReservations.CityTaxCurrencyStr = CityTaxCurrencyStr.Name;
+
+                    if (_hotelReservations.CheckType == "") _hotelReservations.CheckTypeStr = "客人房";
+                    else if (_hotelReservations.CheckType == "D") _hotelReservations.CheckTypeStr = "司机房";
+                    else if (_hotelReservations.CheckType == "G") _hotelReservations.CheckTypeStr = "导游房";
+                    else if (_hotelReservations.CheckType == "D&G") _hotelReservations.CheckTypeStr = "司机导游房";
+
+
+
+                }
+               
+                string Sql = string.Format(@"select c.PayDId, s.Name asPayDIdStr,c.ConsumptionPatterns,c.ConsumptionDate,c.CTDId,
+                                            s1.Name as CTDIdStr,c.BankNo,c.CardholderName,c.PayMoney,c.PaymentCurrency,s2.Name
+                                            as PaymentCurrencyStr,c.DayRate,c.CompanyBankNo,c.OtherBankName,c.OtherSideNo,c.OtherSideName,
+                                            c.IsAuditGM,c.Payee,c.RMBPrice,c.OrbitalPrivateTransfer from Grp_CreditCardPayment c
+                                            left join Sys_SetData s on c.PayDId=s.Id
+                                            left join Sys_SetData s1 on c.CTDId=s1.Id
+                                            left join Sys_SetData s2 on c.PaymentCurrency=s2.Id
+                                            where c.CId ={0} and c.IsDel = 0 and c.CTable = 76",dto.Id);
+                Grp_CreditCardView _CreditCardPayment = _sqlSugar.SqlQueryable<Grp_CreditCardView>(Sql).First();
+                if (_CreditCardPayment!=null)
+                {
+                    if(!string.IsNullOrWhiteSpace(_CreditCardPayment.ConsumptionDate)) _CreditCardPayment.ConsumptionDate=Convert.ToDateTime(_CreditCardPayment.ConsumptionDate).ToString("yyyy-MM-dd");
+                }
                 var data = new
                 {
                     hotelReservations = _hotelReservations,

+ 57 - 0
OASystem/OASystem.Infrastructure/Repositories/System/SetDataRepository.cs

@@ -3,9 +3,12 @@ using AutoMapper;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.System;
 using OASystem.Domain.Dtos.UserDto;
+using OASystem.Domain.Entities.Financial;
 using OASystem.Domain.Entities.Resource;
 using OASystem.Domain.Entities.System;
+using OASystem.Domain.ViewModels.Groups;
 using OASystem.Domain.ViewModels.System;
+using OASystem.Infrastructure.Tools;
 
 namespace OASystem.Infrastructure.Repositories.System
 {
@@ -275,5 +278,59 @@ namespace OASystem.Infrastructure.Repositories.System
             }
             return result;
         }
+
+        public async Task<Result> PostCurrencyByDiid(int diId,int CId, int currencyId)
+        {
+            if (diId==0)
+            {
+                return new Result() { Code = -1, Msg = "请传入团组Id!" };
+            }
+            if (CId == 0)
+            {
+                return new Result() { Code = -1, Msg = "请传入类型Id!" };
+            }
+            if (currencyId == 0)
+            {
+                return new Result() { Code = -1, Msg = "请传入币种Id!" };
+            }
+            Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == diId && a.IsDel == 0 && a.CTable == CId);
+            List<CurrencyInfo> currencyInfos = new List<CurrencyInfo>();
+            CurrencyInfo CurrencyRate = new CurrencyInfo();
+            try
+            {
+                if (_TeamRate != null)
+                {
+                    Sys_SetData _SetData = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == currencyId);
+                    if (_SetData != null)
+                    {
+                        currencyInfos = CommonFun.GetCurrencyChinaToList(_TeamRate.Remark);
+                        CurrencyRate = currencyInfos.FirstOrDefault(a => a.CurrencyCode == _SetData.Name);
+                        if (CurrencyRate!=null)
+                        {
+                            return new Result() { Code = 0, Msg = "查询成功!", Data = CurrencyRate };
+                        }
+                        else
+                        {
+                            return new Result() { Code = -1, Msg = "暂无团组汇率,请前往设置!", Data = CurrencyRate };
+                        }
+                        
+                    }
+                    else
+                    {
+                        return new Result() { Code = -1, Msg = "暂无团组汇率,请前往设置!", Data = CurrencyRate };
+                    }
+                    
+                }
+                else
+                {
+                    return new Result() { Code = -1, Msg = "暂无团组汇率,请前往设置!", Data = CurrencyRate };
+                }
+            }
+            catch (Exception)
+            {
+                return new Result() { Code = -1, Msg = "查询异常!", Data = CurrencyRate };
+            }
+            
+        }
     }
 }