| 
					
				 | 
			
			
				@@ -3677,16 +3677,22 @@ WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ///  国交数据统计-酒店相关、商要邀请 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ///  酒店预订地区TOP10排序、酒店房型地区间数、商邀邀请国家数量TOP10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ///  国交数据统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ///  酒店预订地区TOP10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <param name="_dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [HttpPost("StatisticsHotel")] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        public async Task<IActionResult> StatisticsHotel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> StatisticsHotel(YOYDto _dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_dto.Year < 1) return Ok(JsonView(false, "操作失败")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string beginDt = $"{_dto.Year}-01-01 00:00:00", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                   endDt = $"{_dto.Year}-12-31 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string sql = string.Format(@" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   hr.DIId, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -3705,31 +3711,112 @@ FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   Grp_HotelReservations hr 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   INNER JOIN Grp_CreditCardPayment ccp ON hr.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   AND ccp.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  AND CTable = 85 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CTable = 76 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   LEFT JOIN Sys_SetData sd ON hr.ReservationsWebsite = sd.Id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   hr.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   AND ccp.IsPay = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    hr.SingleRoomCount > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    OR hr.DoubleRoomCount > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    OR hr.SuiteRoomCount > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    OR hr.OtherRoomCount > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('早餐',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('晚餐',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('升级',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('饮料茶水费',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('城市税',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('退款',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('返现',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('会议室',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('迷你吧消费',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('运费',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('地接',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('损失',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND CHARINDEX('补差',hr.HotelName) = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND hr.CheckInDate BETWEEN '{0}' AND '{1}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ORDER BY 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   hr.CheckInDate 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+",beginDt,endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var data = await _sqlSugar.SqlQueryable<StatisticsHotelView>(sql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             var hotelData = data.OrderBy(x => x.CityStr).ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var airTicketNumData = new List<AirTicketReturnView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var airTicketAreaData = new List<AirTicketCityReturnView>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var hotelCityGroupByData = data.GroupBy(x => x.CityStr) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            .Select(g => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                                city = 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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             .Take(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                             .ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return Ok(JsonView(true, "操作成功!", hotelCityGroupByData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            int monthIndex = 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            while (monthIndex < 13) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ///  国交数据统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ///  商邀邀请国家数量TOP10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <param name="_dto"></param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [HttpPost("StatisticsInvitation")] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        public async Task<IActionResult> StatisticsInvitation(YOYDto _dto) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                monthIndex++; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (_dto.Year < 1) return Ok(JsonView(false, "操作失败")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string beginDt = $"{_dto.Year}-01-01 00:00:00", 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                   endDt = $"{_dto.Year}-12-31 23:59:59"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            string sql = string.Format(@" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ioa.DiId, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ioa.InviterArea AS Country 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  Grp_InvitationOfficialActivities ioa 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  INNER JOIN Grp_CreditCardPayment ccp ON ioa.Id = ccp.CId 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND ccp.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND ccp.CTable = 81 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ioa.IsDel = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND ccp.IsPay = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  AND ioa.CreateTime BETWEEN '{0}' AND '{1}' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+", beginDt, endDt); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var data = await _sqlSugar.SqlQueryable<StatisticsInvitation>(sql).ToListAsync(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var groupByData = data.GroupBy(x => x.Country) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  .Select(g => new 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        Country = g.Key, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        TimeNum = g.Count(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                        LinkGroupIds = g.Select(x => x.DIId).ToList() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  .OrderByDescending(x => x.TimeNum) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  .Take(10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                  .ToList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return Ok(JsonView(true, "操作成功!", new { hotelData = hotelData, airTicketAreaData = airTicketAreaData })); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return Ok(JsonView(true, "操作成功!", groupByData)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion 
			 |