Переглянути джерело

Statistics/StatisticsAirTicket(国交数据统计-机票相关) 新增返回数据airTicketPlatformData(预订平台) Statistics/StatisticsHotel(国交数据统计-酒店相关) 新增返回数据hotelPlatformData(预订平台)

LEIYI 4 місяців тому
батько
коміт
70d3c2de0d

+ 67 - 8
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -4,6 +4,7 @@ using OASystem.Domain.Dtos.Statistics;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Groups;
 using OASystem.Domain.ViewModels.Financial;
+using OASystem.Domain.ViewModels.QiYeWeChat;
 using OASystem.Domain.ViewModels.Statistics;
 using OASystem.Infrastructure.Repositories.Groups;
 using System.Data;
@@ -3685,7 +3686,7 @@ ORDER BY
 
         /// <summary>
         ///  国交数据统计-机票相关
-        ///  1、机票票数、2、机票到达地
+        ///  机票票数、机票到达地、预订平台
         /// </summary>
         /// <param name="_dto"></param>
         /// <returns></returns>
@@ -3709,7 +3710,12 @@ SELECT
   sd.Name As CTypeName,
   atr.FlightsCity,
   atr.ClientNum,
-  atr.ClientName
+  atr.ClientName,
+  di.TeamName As 'GroupName',
+  CASE 
+    WHEN ccp.Payee = '' OR ccp.Payee IS NULL THEN '未知'
+    ELSE ccp.Payee
+  END AS 'Platform'
 FROM
   Grp_AirTicketReservations atr
   INNER JOIN Grp_CreditCardPayment ccp ON atr.Id = ccp.CId
@@ -3720,7 +3726,7 @@ FROM
 WHERE
   atr.IsDel = 0
   AND di.TeamDid IN (38,39,40,1048)
-  And atr.CType IN(457,458,459,460,574,575)
+  AND atr.CType IN(457,458,459,460,574,575)
   AND CHARINDEX('行程单',atr.ClientName) = 0
   AND CHARINDEX('返点',atr.ClientName) = 0
   AND CHARINDEX('-1',atr.ClientName) = 0
@@ -3808,7 +3814,7 @@ WHERE
 
                 //机票城市处理
                 //城市处理
-                List<string> airTicketCityInfos = new List<string>();
+                var airTicketCityInfos = new List<string>();
                 foreach (var item in monthData)
                 {
                     if (!string.IsNullOrEmpty(item.FlightsCityName))
@@ -3850,12 +3856,41 @@ WHERE
                 monthIndex++;
             }
 
-            return Ok(JsonView(true, "操作成功!", new { airTicketNumData = airTicketNumData, airTicketAreaData = airTicketAreaData }));
+            var airTicketPlatformData = data.GroupBy(g => g.Platform)
+                .Select(g => new
+                {
+                    platform = g.Key,
+                    total = g.Sum(x => x.ClientNum),
+                    children = g.GroupBy(g1 => g1.DIId)
+                                .Select(g1 => new { 
+                                    diId = g1.Key,
+                                    groupName = g1.FirstOrDefault()?.GroupName ?? "-",
+                                    total = g1.Sum(x1 => x1.ClientNum),
+                                    children = g1.Select(x1 => new {
+                                        //diId = x1.DIId,
+                                        //groupName = x1.GroupName,
+                                                  flightsCityName=x1.FlightsCityName,
+                                                  total = x1.ClientNum
+                                                 })
+                                                 .ToList()
+                                })
+                                .OrderByDescending(x1 => x1.total)
+                                .ToList()
+                })
+                .OrderByDescending(x => x.total)
+                .ToList();
+
+            return Ok(JsonView(true, "操作成功!", new
+            {
+                airTicketNumData = airTicketNumData,
+                airTicketAreaData = airTicketAreaData,
+                airTicketPlatformData = airTicketPlatformData
+            }));
         }
 
         /// <summary>
-        ///  国交数据统计
-        ///  酒店预订地区TOP10
+        ///  国交数据统计-酒店
+        ///  地区TOP10、预订平台
         /// </summary>
         /// <param name="_dto"></param>
         /// <returns></returns>
@@ -3948,7 +3983,31 @@ ORDER BY
                                              .Take(10)
                                              .ToList();
 
-            return Ok(JsonView(true, "操作成功!", hotelCityGroupByData));
+            var hotelPlatformGroupByData = data.GroupBy(x => x.BookinSite)
+                                               .Select(g => new
+                                               {
+                                                   Platform = g.Key,
+                                                   BookingRoomNum = g.Sum(x => x.RoomTotal),
+                                                   hotelData = g.GroupBy(x => x.HotelName)
+                                                                .Select(g1 => new
+                                                                {
+                                                                    hotelName = g1.Key,
+                                                                    roomNights = g1.Sum(x => x.RoomNights),
+                                                                    roomTotal = g1.Sum(x => x.RoomTotal),
+                                                                    singleRoomCount = g1.Sum(x => x.SingleRoomCount),
+                                                                    doubleRoomCount = g1.Sum(x => x.DoubleRoomCount),
+                                                                    suiteRoomCount = g1.Sum(x => x.SuiteRoomCount),
+                                                                    otherRoomCount = g1.Sum(x => x.OtherRoomCount),
+                                                                })
+                                                                .ToList(),
+                                                   linkGroupIds = g.Select(x => x.DIId).Distinct().ToList()
+
+                                               })
+                                               .OrderByDescending(x => x.BookingRoomNum)
+                                               .ToList();
+
+
+            return Ok(JsonView(true, "操作成功!", new { hotelCityData = hotelCityGroupByData , hotelPlatformData = hotelPlatformGroupByData }));
         }
 
         /// <summary>

+ 2 - 1
OASystem/OASystem.Domain/ViewModels/Financial/Fin_DailyFeePaymentView.cs

@@ -744,6 +744,8 @@ namespace OASystem.Domain.ViewModels.Financial
         public string FlightsCity { get; set; }
         public string FlightsCityName { get; set; }
         public int ClientNum { get; set; }
+        public string GroupName { get; set; }
+        public string Platform { get; set; }
     }
 
     public class AirTicketReturnView
@@ -829,7 +831,6 @@ namespace OASystem.Domain.ViewModels.Financial
             this.Quantity = quantity;
 
         }
-
     }
 
     public class AirTicketCityInfo

+ 0 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/AirTicketResRepository.cs

@@ -323,7 +323,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 #region 团组下拉框
 
-
                 List<Grp_GroupsTaskAssignment> grp_GroupsTaskAssignment = Query<Grp_GroupsTaskAssignment>(a => a.IsDel == 0 && a.UId == dto.UserId && a.CTId == 85).ToList();
                 List<GroupNameView> grp_NameView = new List<GroupNameView>();
                 string DiId = "";