2 Commits 1fadf81e82 ... bc19df56d8

Author SHA1 Message Date
  wangh bc19df56d8 Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop 1 year ago
  wangh 6c3fd17019 保险接口编写 1 year ago

+ 27 - 3
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -3462,7 +3462,7 @@ namespace OASystem.API.Controllers
             }
         }
         /// <summary>
-        /// 根团组Id查询酒店费用列表
+        /// 根团组Id查询酒店费用列表
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -3485,7 +3485,7 @@ namespace OASystem.API.Controllers
             }
         }
         /// <summary>
-        /// 根酒店费用Id查询酒店费用详细
+        /// 根酒店费用Id查询酒店费用详细
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -4098,7 +4098,7 @@ namespace OASystem.API.Controllers
 
         #region 保险费用录入
         /// <summary>
-        /// 根据团组Id查询费用列表
+        /// 根据团组Id查询保险费用列表
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
@@ -4120,6 +4120,30 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, ex.Message));
             }
         }
+
+        /// <summary>
+        /// 根据保险费用Id查询保险费用详细
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> CustomersById(CustomersByIdDto dto)
+        {
+            try
+            {
+                Result groupData = await _customersRep.CustomersById(dto);
+                if (groupData.Code != 0)
+                {
+                    return Ok(JsonView(false, groupData.Msg));
+                }
+                return Ok(JsonView(true, groupData.Msg, groupData.Data));
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, ex.Message));
+            }
+        }
         #endregion
     }
 }

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

@@ -145,6 +145,11 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<Grp_CreditCardPayment, Grp_CreditCardView>();
             CreateMap<OpHotelReservationsData, Grp_HotelReservations>();
             CreateMap<OpHotelReservationsData, Grp_CreditCardPayment>();
+            #endregion
+            CreateMap<Grp_HotelReservations, CustomersByIdView>();
+            CreateMap<Grp_CreditCardPayment, CustomersByIdView>();
+            #region 保险费用
+
             #endregion
 
             #endregion

+ 7 - 0
OASystem/OASystem.Domain/Dtos/Groups/CustomersDto.cs

@@ -10,4 +10,11 @@ namespace OASystem.Domain.Dtos.Groups
     {
         public int DiId { get; set; }
     }
+    /// <summary>
+    /// 根据Id查询单条数据和c表数据
+    /// </summary>
+    public class CustomersByIdDto
+    {
+        public int Id { get; set; }
+    }
 }

+ 179 - 0
OASystem/OASystem.Domain/ViewModels/Groups/CustomersView.cs

@@ -0,0 +1,179 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.Groups
+{
+    /// <summary>
+    /// 根据团组Id查询保险费用列表
+    /// </summary>
+    public class CustomersView
+    {
+        public int RowNumber { get; set; }
+        /// <summary>
+        /// 主键Id
+        /// </summary>
+        public int Id { get; set; }
+        /// <summary>
+        /// 客人姓名
+        /// </summary>
+        public string ClientName { get; set; }
+        /// <summary>
+        /// 保险费用
+        /// </summary>
+        public decimal InsuranceCosts { get; set; }
+        /// <summary>
+        /// 保险费用币种
+        /// </summary>
+        public int Currency { get; set; }
+        /// <summary>
+        /// 保险费用币种Str
+        /// </summary>
+        public string CurrencyStr { get; set; }
+        /// <summary>
+        /// 附件地址
+        /// </summary>
+        public string Attachment { get; set; }
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+        /// <summary>
+        /// 费用表示Str
+        /// </summary>
+        public string OrbitalPrivateTransferStr { get; set; }
+        /// <summary>
+        /// 创建人姓名
+        /// </summary>
+        public string CnName { get; set; }
+        /// <summary>
+        /// 是否审核
+        /// </summary>
+        public int IsAuditGM { get; set; }
+        /// <summary>
+        /// 是否审核Str
+        /// </summary>
+        public string IsAuditGMStr { get; set; }
+    }
+
+    public class CustomersByIdView 
+    {
+        /// <summary>
+        /// 主键Id
+        /// </summary>
+        public int Id { get; set; }
+        /// <summary>
+        /// 团组外键编号
+        /// </summary>
+        public int DiId { get; set; }
+        /// <summary>
+        /// 保险名称
+        /// </summary>
+        public int Iid { get; set; }
+        /// <summary>
+        /// 保险名称Str
+        /// </summary>
+        public string IidStr { get; set; }
+
+        /// <summary>
+        /// 客户名称
+        /// </summary>
+        public string ClientName { get; set; }
+
+        /// <summary>
+        /// 保险费用
+        /// </summary>
+        public decimal InsuranceCosts { get; set; }
+
+        /// <summary>
+        /// 币种
+        /// </summary>
+        public int Currency { get; set; }
+        /// <summary>
+        /// 币种Str
+        /// </summary>
+        public string CurrencyStr { get; set; }
+        /// <summary>
+        /// 保险附件
+        /// </summary>
+        public string Attachment { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        public string Remark { get; set; }
+
+        //c表dto参数
+        /// <summary>
+        /// 支付方式
+        /// </summary>
+        public int PayDId { get; set; }
+        /// <summary>
+        /// 支付方式Str
+        /// </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>
+        /// 卡类型Str
+        /// </summary>
+        public string CTDIdStr { 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>
+        /// 银行卡号
+        /// </summary>
+        public string BankNo { get; set; }
+        /// <summary>
+        /// 持卡人姓名
+        /// </summary>
+        public string CardholderName { get; set; }
+        /// <summary>
+        /// 收款方
+        /// </summary>
+        public string Payee { get; set; }
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public int OrbitalPrivateTransfer { get; set; }
+        /// <summary>
+        /// 费用标识
+        /// </summary>
+        public string OrbitalPrivateTransferStr { get; set; }
+        /// <summary>
+        /// 总经理是否审核  0 未审核 1已通过 2未通过
+        /// </summary>
+        public int IsAuditGM { get; set; }
+        /// <summary>
+        /// C表备注
+        /// </summary>
+        public string CRemark { get; set; }
+    }
+}

+ 75 - 53
OASystem/OASystem.Infrastructure/Repositories/Groups/CustomersRepository.cs

@@ -11,21 +11,25 @@ using System.Threading.Tasks;
 
 namespace OASystem.Infrastructure.Repositories.Groups
 {
-    public class CustomersRepository:BaseRepository<Grp_Customers, Grp_Ommission>
+    public class CustomersRepository : BaseRepository<Grp_Customers, Grp_Ommission>
     {
         private readonly IMapper _mapper;
-    public CustomersRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
-    {
-        _mapper = mapper;
-    }
-
+        public CustomersRepository(SqlSugarClient sqlSugar, IMapper mapper) : base(sqlSugar)
+        {
+            _mapper = mapper;
+        }
+        /// <summary>
+        /// 根据团组Id查询保险费用列表
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
         public async Task<Result> CustomersByDiId(CustomersByDiIdDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             try
             {
                 string UserId = "";
-                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 76).ToList();
+                List<Grp_GroupsTaskAssignment> gtaUIdList = _sqlSugar.Queryable<Grp_GroupsTaskAssignment>().Where(a => a.DIId == dto.DiId && a.IsDel == 0 && a.CTId == 82).ToList();
                 foreach (Grp_GroupsTaskAssignment gta in gtaUIdList)
                     UserId += gta.UId + ",";
 
@@ -43,71 +47,54 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 int endIndex = startIndex + dto.PageSize - 1;
                 if (dto.PortType == 1)
                 {
-                    string sql = string.Format(@"select h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
-                                                h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
-                                                From Grp_HotelReservations h 
-                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
-                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id  
-                                                left Join Sys_SetData s1 on h.GTId=s1.Id 
-                                                left Join Sys_Users u on u.Id=h.CreateUserId {0} order by c.IsAuditGM,c.PayPercentage desc", sqlWhere);
-                    List<HotelReservationsByDiIdView> hotelDataList = _sqlSugar.SqlQueryable<HotelReservationsByDiIdView>(sql).ToList();
-                    foreach (var item in hotelDataList)
+                    string sql = string.Format(@"select h.Id,h.ClientName,InsuranceCosts,Currency,s.Name as CurrencyStr,Attachment,c.OrbitalPrivateTransfer,u.CnName,c.IsAuditGM
+                                                    From Grp_Customers h 
+                                                    Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=82 and c.isdel=0
+                                                    left Join Sys_SetData s on  h.Currency=s.Id
+                                                    left Join Sys_Users u on u.Id=h.CreateUserId {0} order by c.IsAuditGM,c.PayPercentage,h.CreateTime desc", sqlWhere);
+                    List<CustomersView> Customers = _sqlSugar.SqlQueryable<CustomersView>(sql).ToList();
+                    foreach (var item in Customers)
                     {
                         if (item.IsAuditGM == 0) item.IsAuditGMStr = "未审核";
                         else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
                         else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
                         else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
-                        if (!string.IsNullOrWhiteSpace(item.CheckInDate))
-                        {
-                            item.CheckInDate = DateTime.Parse(item.CheckInDate).ToString("yyyy-MM-dd");
-                        }
-                        if (!string.IsNullOrWhiteSpace(item.CheckOutDate))
-                        {
-                            item.CheckOutDate = DateTime.Parse(item.CheckOutDate).ToString("yyyy-MM-dd");
-                        }
-
 
+                        if (item.OrbitalPrivateTransfer == 0) item.OrbitalPrivateTransferStr = "公转";
+                        else if (item.OrbitalPrivateTransfer == 1) item.OrbitalPrivateTransferStr = "私转";
 
                     }
-                    return result = new Result() { Code = 0, Msg = "查询成功!", Data = hotelDataList };
+                    return result = new Result() { Code = 0, Msg = "查询成功!", Data = Customers };
                 }
                 else if (dto.PortType == 2 || dto.PortType == 3)
                 {
                     string sql = string.Format(@"Select * From (	
-                                                Select row_number() over (order by c.IsAuditGM,c.PayPercentage desc) as RowNumber,h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
-                                                h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
-                                                 From Grp_HotelReservations h 
-                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
-                                                left Join Sys_SetData s on  c.PaymentCurrency=s.Id 
-                                                left Join Sys_SetData s1 on h.GTId=s1.Id 
-                                                left Join Sys_Users u on u.Id=h.CreateUserId   {0}
+                                                Select row_number() over (order by c.IsAuditGM,c.PayPercentage,h.CreateTime desc) as RowNumber,h.Id,h.ClientName,InsuranceCosts,
+                                                Currency,s.Name as CurrencyStr,Attachment,c.OrbitalPrivateTransfer,u.CnName,c.IsAuditGM
+                                                From Grp_Customers h 
+                                                Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=82 and c.isdel=0
+                                                left Join Sys_SetData s on  h.Currency=s.Id  
+                                                left Join Sys_Users u on u.Id=h.CreateUserId  {0}
                                                 ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
 
-                    List<HotelReservationsByDiIdView> hotelDataList = _sqlSugar.SqlQueryable<HotelReservationsByDiIdView>(sql).ToList();
-                    foreach (var item in hotelDataList)
+                    List<CustomersView> Customers = _sqlSugar.SqlQueryable<CustomersView>(sql).ToList();
+                    foreach (var item in Customers)
                     {
                         if (item.IsAuditGM == 0) item.IsAuditGMStr = "未审核";
                         else if (item.IsAuditGM == 1) item.IsAuditGMStr = "已通过";
                         else if (item.IsAuditGM == 2) item.IsAuditGMStr = "未通过";
                         else if (item.IsAuditGM == 3) item.IsAuditGMStr = "自动审核";
-                        if (!string.IsNullOrWhiteSpace(item.CheckInDate))
-                        {
-                            item.CheckInDate = DateTime.Parse(item.CheckInDate).ToString("yyyy-MM-dd");
-                        }
-                        if (!string.IsNullOrWhiteSpace(item.CheckOutDate))
-                        {
-                            item.CheckOutDate = DateTime.Parse(item.CheckOutDate).ToString("yyyy-MM-dd");
-                        }
+
+                        if (item.OrbitalPrivateTransfer == 0) item.OrbitalPrivateTransferStr = "公转";
+                        else if (item.OrbitalPrivateTransfer == 1) item.OrbitalPrivateTransferStr = "私转";
                     }
                     string CountSql = string.Format(@"Select COUNT(1) as Count From (	
-                                                        Select h.Id,s1.Name as GuestType,h.ReservationsNo,h.HotelName,h.CheckInDate,
-                                                        h.CheckOutDate,c.PayMoney,s.Name as PaymentCurrency,u.CnName as CreateUserName,c.IsAuditGM,h.CreateTime,h.Attachment
-                                                        From Grp_HotelReservations h 
-                                                        Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=76 and c.isdel=0
-                                                        left Join Sys_SetData s on  c.PaymentCurrency=s.Id 
-                                                        left Join Sys_SetData s1 on h.GTId=s1.Id 
-                                                        left Join Sys_Users u on u.Id=h.CreateUserId  {0}
-                                                        ) temp", sqlWhere);
+                                                    select h.Id,h.ClientName,InsuranceCosts,Currency,s.Name as CurrencyStr,Attachment,c.OrbitalPrivateTransfer,u.CnName,c.IsAuditGM
+                                                    From Grp_Customers h 
+                                                    Join Grp_CreditCardPayment c on h.Id=c.CId and c.CTable=82 and c.isdel=0
+                                                    left Join Sys_SetData s on  h.Currency=s.Id  
+                                                    left Join Sys_Users u on u.Id=h.CreateUserId   {0}
+                                                    ) temp", sqlWhere);
                     DataCount dataCount = _sqlSugar.SqlQueryable<DataCount>(CountSql).First();
 
                     int count = dataCount.Count;
@@ -115,8 +102,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (totalPage == 0) totalPage = 1;
                     else totalPage = (int)Math.Ceiling((double)totalPage);
 
-                    ListViewBase<HotelReservationsByDiIdView> rst = new ListViewBase<HotelReservationsByDiIdView>();
-                    rst.DataList = hotelDataList;
+                    ListViewBase<CustomersView> rst = new ListViewBase<CustomersView>();
+                    rst.DataList = Customers;
                     rst.DataCount = count;
                     rst.CurrPageIndex = dto.PageIndex;
                     rst.CurrPageSize = dto.PageSize;
@@ -134,5 +121,40 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 throw;
             }
         }
+
+        public async Task<Result> CustomersById(CustomersByIdDto dto)
+        {
+            Result result = new Result() { Code = -2, Msg = "未知错误" };
+            try
+            {
+                Grp_Customers grp_Customers = _sqlSugar.Queryable<Grp_Customers>().First(a=>a.Id==dto.Id && a.IsDel==0);
+                CustomersByIdView customersById = _mapper.Map<CustomersByIdView>(grp_Customers);
+                Grp_CreditCardPayment creditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable==82);
+                customersById = _mapper.Map<CustomersByIdView>(creditCardPayment);
+                if (customersById != null)
+                {
+                    Sys_SetData Iid = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == customersById.Iid);
+                    if (Iid != null) customersById.IidStr = Iid.Name;
+
+                    Sys_SetData Currency = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == customersById.Currency);
+                    if (Currency != null) customersById.CurrencyStr = Currency.Name;
+
+                    Sys_SetData PayDId = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == customersById.PayDId);
+                    if (PayDId != null) customersById.PayDIdStr = PayDId.Name;
+
+                    Sys_SetData CTDId = _sqlSugar.Queryable<Sys_SetData>().First(a => a.IsDel == 0 && a.Id == customersById.CTDId);
+                    if (CTDId != null) customersById.CTDIdStr = CTDId.Name;
+
+                    customersById.OrbitalPrivateTransferStr=customersById.OrbitalPrivateTransfer== 0 ? "公转" : "私转";
+                    customersById.CRemark = creditCardPayment.Remark;
+                }
+                return result = new Result() { Code = 0, Msg = "查询成功!",Data= customersById };
+            }
+            catch (Exception ex)
+            {
+                return result = new Result() { Code = -2, Msg = "未知错误" };
+                throw;
+            }
+        }
     }
 }