Browse Source

付款申请 (PageId=51) 查询 根据日期范围、团组,日付相关费用 选中状态变更 接口业务逻辑更改

leiy 9 months ago
parent
commit
38593a46db

+ 127 - 107
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -2035,7 +2035,7 @@ namespace OASystem.API.Controllers
                 }
 
                 tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(dto.Status, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt);
-                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(dto.Status, checkedView.GroupIds, dto.beginDt, dto.endDt);
+                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(dto.Status, checkedView.GroupIds, checkedView.HotelSubIds, dto.beginDt, dto.endDt);
 
                 stopwatch.Stop();
                 return Ok(JsonView(true, $"查询成功!耗时{stopwatch.ElapsedMilliseconds / 1000}s", new { daily = dailyResult, group = groupResult }));
@@ -2093,7 +2093,7 @@ namespace OASystem.API.Controllers
         /// <param name="beginDt"></param>
         /// <param name="endDt"></param>
         /// <returns></returns>
-        private tree_Group_DailyFeePaymentResult PayRequest_GroupPaymentByDateRange(int status, List<int> _groupIds, string beginDt, string endDt)
+        private tree_Group_DailyFeePaymentResult PayRequest_GroupPaymentByDateRange(int status, List<int> _groupIds,List<int> _hotelSubIds, string beginDt, string endDt)
         {
             tree_Group_DailyFeePaymentResult _DailyFeePaymentResult = new tree_Group_DailyFeePaymentResult();
             List<tree_Group_DailyFeePaymentPageListView> dataList = new List<tree_Group_DailyFeePaymentPageListView>();
@@ -2257,6 +2257,8 @@ namespace OASystem.API.Controllers
 
                     if (payInfo.CTable == 76) //酒店单独处理
                     {
+                        
+
                         var hotelContents = hotelContentDatas.Where(it => it.HrId == payInfo.CId);
                         List<Group_DailyFeePaymentContentInfolView> childInfos = new List<Group_DailyFeePaymentContentInfolView>();
                         foreach (var hotelContent in hotelContents)
@@ -2279,6 +2281,9 @@ namespace OASystem.API.Controllers
                             decimal _CNYSubTotalAmount1 = _PaymentAmount1 * hotelContent.Rate;//此次付款金额
                             _CNYSubTotalAmount1 = Convert.ToDecimal(_CNYSubTotalAmount1.ToString("#0.00"));
 
+                            //酒店子项Id选中状态更改
+                            if (_hotelSubIds != null) status1 = _hotelSubIds.Contains(hotelContent.Id);
+
                             var childInfo1 = new Group_DailyFeePaymentContentInfolView()
                             {
                                 IsChecked = status1,
@@ -2492,6 +2497,7 @@ namespace OASystem.API.Controllers
             PaymentRequestCheckedView requestCheckedView = new PaymentRequestCheckedView();
             List<int> groupIds = new List<int>();
             List<int> dailyPaymentIds = new List<int>();
+            List<int> hotelIds = new List<int>();
 
             #region 参数处理
             if (!string.IsNullOrEmpty(dto.GroupIds))
@@ -2506,6 +2512,18 @@ namespace OASystem.API.Controllers
                 }
             }
 
+            if (!string.IsNullOrEmpty(dto.HotelSubIds))
+            {
+                if (dto.HotelSubIds.Contains(","))
+                {
+                    hotelIds = dto.HotelSubIds.Split(',').Select(int.Parse).ToList();
+                }
+                else
+                {
+                    hotelIds.Add(int.Parse(dto.HotelSubIds));
+                }
+            }
+
             if (!string.IsNullOrEmpty(dto.DailyPaymentIds))
             {
                 if (dto.DailyPaymentIds.Contains(","))
@@ -2519,6 +2537,7 @@ namespace OASystem.API.Controllers
             }
             #endregion
             requestCheckedView.GroupIds = groupIds;
+            requestCheckedView.HotelSubIds = hotelIds;
             requestCheckedView.DailyPaymentIds = dailyPaymentIds;
             if (dto.Type == 1)
             {
@@ -2631,7 +2650,7 @@ namespace OASystem.API.Controllers
                 }
 
                 tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(1, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt);
-                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(1, checkedView.GroupIds, dto.beginDt, dto.endDt);
+                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(1, checkedView.GroupIds, checkedView.HotelSubIds, dto.beginDt, dto.endDt);
 
                 decimal _gz = dailyResult.gz + groupResult.gz;
                 decimal _sz = dailyResult.sz + groupResult.sz;
@@ -2654,133 +2673,134 @@ namespace OASystem.API.Controllers
         {
             if (dto.UserId < 1) return Ok(JsonView(false, "请传入有效的UserId参数!"));
 
-            //if (string.IsNullOrEmpty(dto.GroupIds))
-            //{
-            //    return Ok(JsonView(false, "请传入有效的GroupIds参数!"));
-            //}
+            if (string.IsNullOrEmpty(dto.GroupIds))
+            {
+                return Ok(JsonView(false, "请传入有效的GroupIds参数!"));
+            }
 
-            //if (string.IsNullOrEmpty(dto.DailyPaymentIds))
-            //{
-            //    return Ok(JsonView(false, "请传入有效的DailyPaymentIds参数!"));
-            //}
+            if (string.IsNullOrEmpty(dto.DailyPaymentIds))
+            {
+                return Ok(JsonView(false, "请传入有效的DailyPaymentIds参数!"));
+            }
 
-           
-                List<int> groupIds = new List<int>();
-                List<int> dailyPaymentIds = new List<int>();
 
-                #region 参数处理
-                if (!string.IsNullOrEmpty(dto.GroupIds))
-                {
-                    if (dto.GroupIds.Contains(",")) groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList();
-                    else groupIds.Add(int.Parse(dto.GroupIds));
-                }
-
-                //if (!string.IsNullOrEmpty(dto.HotelSubIds))
-                //{
-                //    if (dto.HotelSubIds.Contains(",")) hotelSubIds = dto.HotelSubIds.Split(',').Select(int.Parse).ToList();
-                //    else hotelSubIds.Add(int.Parse(dto.HotelSubIds));
-                //    if (hotelSubIds.Count > 0)
-                //    {
-                //        foreach (var item in hotelSubIds)
-                //        {
-                //            if (item < 1)
-                //            {
-                //                hotelSubIds.Remove(item);
-                //            }
-                //        }
-                //    }
-                //}
-
-                if (!string.IsNullOrEmpty(dto.DailyPaymentIds))
-                {
-                    if (dto.DailyPaymentIds.Contains(",")) dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList();
-                    else dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds));
-                }
-                #endregion
+            List<int> groupIds = new List<int>();
+            List<int> dailyPaymentIds = new List<int>();
+            List<int> hotelSubIds = new List<int>();
 
-                bool changeStatus = false;
-                _sqlSugar.BeginTran();
+            #region 参数处理
+            if (!string.IsNullOrEmpty(dto.GroupIds))
+            {
+                if (dto.GroupIds.Contains(",")) groupIds = dto.GroupIds.Split(',').Select(int.Parse).ToList();
+                else groupIds.Add(int.Parse(dto.GroupIds));
+            }
 
-                if (groupIds.Count > 0)
+            if (!string.IsNullOrEmpty(dto.HotelSubIds))
+            {
+                if (dto.HotelSubIds.Contains(",")) hotelSubIds = dto.HotelSubIds.Split(',').Select(int.Parse).ToList();
+                else hotelSubIds.Add(int.Parse(dto.HotelSubIds));
+                if (hotelSubIds.Count > 0)
                 {
-                    var groupStatus = _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                                               .SetColumns(it => it.IsPay == 1)
-                                               .Where(it => groupIds.Contains(it.Id))
-                                               .ExecuteCommand();
-                    if (groupStatus > 0)
+                    foreach (var item in hotelSubIds)
                     {
-                        changeStatus = true;
-
-
-                        //更改酒店子表支付状态
-                        var ccps = _sqlSugar.Queryable<Grp_CreditCardPayment>()
-                                               .Where(it => groupIds.Contains(it.Id) && it.CTable == 76)
-                                               .ToList();
-                        List<int> hrIds = ccps.Select(it => it.CId).ToList();
-                        if (hrIds.Count > 0)
+                        if (item < 1)
                         {
-                            var hrIspayStatus = _sqlSugar.Updateable<Grp_HotelReservationsContent>()
-                                                       .SetColumns(it => it.IsPay == 1)
-                                                       .Where(it => hrIds.Contains(it.Id))
-                                                       .ExecuteCommand();
-
+                            hotelSubIds.Remove(item);
                         }
                     }
                 }
+            }
 
-                //if (hotelSubIds.Count > 0)
-                //{
-                //    var groupStatus = _sqlSugar.Updateable<Grp_HotelReservationsContent>()
-                //                               .SetColumns(it => it.IsPay == 1)
-                //                               .Where(it => hotelSubIds.Contains(it.Id))
-                //                               .ExecuteCommand();
-                //    if (groupStatus > 0)
-                //    {
-                //        changeStatus = true;
-                //    }
-                //}
-
-                if (dailyPaymentIds.Count > 0)
+            if (!string.IsNullOrEmpty(dto.DailyPaymentIds))
+            {
+                if (dto.DailyPaymentIds.Contains(",")) dailyPaymentIds = dto.DailyPaymentIds.Split(',').Select(int.Parse).ToList();
+                else dailyPaymentIds.Add(int.Parse(dto.DailyPaymentIds));
+            }
+            #endregion
+
+            bool changeStatus = false;
+            _sqlSugar.BeginTran();
+
+            if (groupIds.Count > 0)
+            {
+                var groupStatus = _sqlSugar.Updateable<Grp_CreditCardPayment>()
+                                           .SetColumns(it => it.IsPay == 1)
+                                           .Where(it => groupIds.Contains(it.Id))
+                                           .ExecuteCommand();
+                if (groupStatus > 0)
                 {
-                    var dailyPaymentStatus = _sqlSugar.Updateable<Fin_DailyFeePayment>()
-                                               .SetColumns(it => it.IsPay == 1)
-                                               .Where(it => dailyPaymentIds.Contains(it.Id))
-                                               .ExecuteCommand();
-                    if (dailyPaymentStatus > 0)
+                    changeStatus = true;
+
+
+                    //更改酒店子表支付状态
+                    var ccps = _sqlSugar.Queryable<Grp_CreditCardPayment>()
+                                           .Where(it => groupIds.Contains(it.Id) && it.CTable == 76)
+                                           .ToList();
+                    List<int> hrIds = ccps.Select(it => it.CId).ToList();
+                    if (hrIds.Count > 0)
                     {
-                        changeStatus = true;
+                        var hrIspayStatus = _sqlSugar.Updateable<Grp_HotelReservationsContent>()
+                                                   .SetColumns(it => it.IsPay == 1)
+                                                   .Where(it => hrIds.Contains(it.Id))
+                                                   .ExecuteCommand();
+
                     }
                 }
+            }
 
-                if (changeStatus)
+            //if (hotelSubIds.Count > 0)
+            //{
+            //    var groupStatus = _sqlSugar.Updateable<Grp_HotelReservationsContent>()
+            //                               .SetColumns(it => it.IsPay == 1)
+            //                               .Where(it => hotelSubIds.Contains(it.Id))
+            //                               .ExecuteCommand();
+            //    if (groupStatus > 0)
+            //    {
+            //        changeStatus = true;
+            //    }
+            //}
+
+            if (dailyPaymentIds.Count > 0)
+            {
+                var dailyPaymentStatus = _sqlSugar.Updateable<Fin_DailyFeePayment>()
+                                           .SetColumns(it => it.IsPay == 1)
+                                           .Where(it => dailyPaymentIds.Contains(it.Id))
+                                           .ExecuteCommand();
+                if (dailyPaymentStatus > 0)
                 {
-                    _sqlSugar.CommitTran();
+                    changeStatus = true;
+                }
+            }
 
-                    #region 应用推送
-                    try
-                    {
-                        foreach (int ccpId in groupIds)
-                        {
-                            List<string> tempList = new List<string>() { ccpId.ToString() };
-                            await AppNoticeLibrary.SendUserMsg_GroupStatus_PayResult(ccpId, tempList);
-                        }
+            if (changeStatus)
+            {
+                _sqlSugar.CommitTran();
 
-                        foreach (int dailyId in dailyPaymentIds)
-                        {
-                            List<string> tempList = new List<string>() { dailyId.ToString() };
-                            await AppNoticeLibrary.DailyPayReminder_Pay_ToUser(dailyId, tempList);
-                        }
-                    }
-                    catch (Exception ex)
+                #region 应用推送
+                try
+                {
+                    foreach (int ccpId in groupIds)
                     {
+                        List<string> tempList = new List<string>() { ccpId.ToString() };
+                        await AppNoticeLibrary.SendUserMsg_GroupStatus_PayResult(ccpId, tempList);
                     }
-                    #endregion
 
-                    return Ok(JsonView(true, "操作成功!"));
+                    foreach (int dailyId in dailyPaymentIds)
+                    {
+                        List<string> tempList = new List<string>() { dailyId.ToString() };
+                        await AppNoticeLibrary.DailyPayReminder_Pay_ToUser(dailyId, tempList);
+                    }
                 }
-                _sqlSugar.RollbackTran();
-                return Ok(JsonView(false, "付款状态修改失败!"));
-            
+                catch (Exception ex)
+                {
+                }
+                #endregion
+
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            _sqlSugar.RollbackTran();
+            return Ok(JsonView(false, "付款状态修改失败!"));
+
         }
 
         /// <summary>
@@ -2845,7 +2865,7 @@ namespace OASystem.API.Controllers
                 }
 
                 tree_Fin_DailyFeePaymentResult dailyResult = PayRequest_DailyByDateRange(2, checkedView.DailyPaymentIds, dto.beginDt, dto.endDt);
-                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(2, checkedView.GroupIds, dto.beginDt, dto.endDt);
+                tree_Group_DailyFeePaymentResult groupResult = PayRequest_GroupPaymentByDateRange(2, checkedView.GroupIds, checkedView.HotelSubIds, dto.beginDt, dto.endDt);
 
                 if (dailyResult.childList == null)
                 {

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

@@ -432,12 +432,14 @@ namespace OASystem.API.Controllers
                     item.RoomPrice = roomData?.Price ?? 0.00M;
                     item.RoomPriceCurrency = _setDatas.Find(it => it.Id == roomData?.Currency)?.Name;
                     string feeMark1 = roomData?.OrbitalPrivateTransfer == 0 ? "公转" : "私转";
+                    string isFeeMark1 = roomData?.IsOppay == 1 ? "是" : "否";
                     item.RoomInfoTips = @$"当时汇率:{roomData?.Rate.ToString("#0.0000")} <br/>
                                            收款方:{roomData?.Payee}<br/>
                                            费用标识:{feeMark1} <br/>
                                            支付方式:{_setDatas.Find(it => it.Id == roomData?.PayDId)?.Name} <br/>
-                                           卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name}";
-                   
+                                           卡类型:{_setDatas.Find(it => it.Id == roomData?.CTDId)?.Name}
+                                           是否由地接支付:{isFeeMark1} <br/>";
+
                     var breakfastData = groupHotelContentFeeViews.Find(it => it.HrId == item.HrId && it.PriceType == 2); //早餐 
                     item.BreakfastPrice = breakfastData?.Price ?? 0.00M;
                     item.BreakfastCurrency = _setDatas.Find(it => it.Id == breakfastData?.Currency)?.Name;
@@ -2141,11 +2143,11 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpPost("PostMarketingSalesStatistics")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> PostMarketingSalesStatistics(MarketingSalesInitDataDto _dto)
+        public async Task<IActionResult> PostMarketingSalesStatistics(MarketingSalesStatisticsDto _dto)
         {
             #region  参数验证
 
-            MarketingSalesInitDataDtoFoalidator validationRules = new MarketingSalesInitDataDtoFoalidator();
+            MarketingSalesStatisticsDtoFoalidator validationRules = new MarketingSalesStatisticsDtoFoalidator();
             var validResult = await validationRules.ValidateAsync(_dto);
             if (!validResult.IsValid)
             {
@@ -2163,64 +2165,9 @@ namespace OASystem.API.Controllers
             if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, MsgTips.CheckAuth));
             #endregion
 
+            string beginDt = $"{_dto.BeginDt}";
 
-            var companyData = _sqlSugar.Queryable<Sys_Company>().Where(it => it.IsDel == 0)
-                                       .Select(it => new { id = it.Id, name = it.CompanyName })
-                                       .ToList();
-            List<int> companyIds = companyData.Select(it => it.id).ToList();
-            //查询所有公司的市场部
-            var depData = _sqlSugar.Queryable<Sys_Department>().Where(it => it.IsDel == 0 && companyIds.Contains(it.CompanyId) && it.DepName.Contains("市场部"))
-                                   .Select(it => new { it.Id, it.CompanyId, it.DepName })
-                                   .ToList();
-            List<int> depIds = depData.Select(it => it.Id).ToList();
-
-            var jobData = _sqlSugar.Queryable<Sys_JobPost>().Where(it => it.IsDel == 0 && companyIds.Contains(it.CompanyId) && (it.JobName.Contains("经理") || it.JobName.Contains("主管")))
-                                   .Select(it => new { it.Id, it.CompanyId, it.DepId, it.JobName })
-                                   .ToList();
-            List<int> jobIds = jobData.Select(it => it.Id).ToList();
-            //userId = 21 
-            var userData = _sqlSugar.Queryable<Sys_Users>().Where(it => it.IsDel == 0 && (depIds.Contains(it.DepId) || jobIds.Contains(it.JobPostId)))
-                                   .Select(it => new { id = it.Id, companyId = it.CompanyId, name = it.CnName })
-                                   .ToList();
-
-            companyData.Insert(0, new { id = -1, name = "全部" });
-            userData.Insert(0, new { id = -1, companyId = -1, name = "全部" });
-
-            #region 年份
-
-            var dtData = new List<dynamic>();
-            int dt = DateTime.Now.Year;
-            for (int i = dt - 4; i <= dt; i++)
-            {
-                //季度
-                var quarterDatas = new List<dynamic>();
-                quarterDatas.Add(new { name = "第一季度", beginDt = $"{i}-01-01", endDt = $"{i}-03-31" });
-                quarterDatas.Add(new { name = "第二季度", beginDt = $"{i}-04-01", endDt = $"{i}-06-30" });
-                quarterDatas.Add(new { name = "第三季度", beginDt = $"{i}-07-01", endDt = $"{i}-09-30" });
-                quarterDatas.Add(new { name = "第四季度", beginDt = $"{i}-10-01", endDt = $"{i}-12-31" });
-
-                //月份
-                var monthDatas = new List<dynamic>();
-
-                for (int m = 1; m < 13; m++)
-                {
-                    MonthlyTimeSegment timeSegment = new MonthlyTimeSegment(i, m);
-                    monthDatas.Add(new { name = $"{ConvertToChinese(m)}", beginDt = timeSegment.Start.ToString("yyyy-MM-dd"), endDt = timeSegment.End.ToString("yyyy-MM-dd") });
-                }
-
-                dtData.Add(new
-                {
-                    year = $"{i}",
-                    yearData = new { beginDt = $"{i}-01-01", endDt = $"{i}-12-31" },
-                    quarterData = quarterDatas,
-                    monthData = monthDatas
-                });
-            }
-
-            #endregion
-
-
-            return Ok(JsonView(true, "操作成功!", new { companyData = companyData, userData = userData, dtData = dtData }));
+            return Ok(JsonView(true, "操作成功!",""));
             #endregion
 
         }

+ 5 - 5
OASystem/OASystem.Domain/Dtos/Financial/PostPayRequestByDateRangeDto.cs

@@ -41,11 +41,11 @@ namespace OASystem.Domain.Dtos.Financial
         /// </summary>
         public string GroupIds { get; set; }
 
-        ///// <summary>
-        ///// 酒店子表费用 Id集合 多个英文逗号隔开 
-        ///// 1,2,3,4,5
-        ///// </summary>
-        //public string HotelSubIds { get; set; }
+        /// <summary>
+        /// 酒店子表费用 Id集合 多个英文逗号隔开 
+        /// 1,2,3,4,5
+        /// </summary>
+        public string HotelSubIds { get; set; }
 
         /// <summary>
         /// 日付相关费用 id集合 多个英文逗号隔开 

+ 2 - 2
OASystem/OASystem.Domain/Dtos/Statistics/MarketingSalesDto.cs

@@ -61,7 +61,7 @@ namespace OASystem.Domain.Dtos.Statistics
     ///  市场部销售额
     ///  年度/季度/月度 报表
     /// </summary>
-    public class MarketingSalesStatistics : MarketingSalesUserPageFuncDtoBase 
+    public class MarketingSalesStatisticsDto : MarketingSalesUserPageFuncDtoBase 
     {
         /// <summary>
         /// 公司Id
@@ -78,7 +78,7 @@ namespace OASystem.Domain.Dtos.Statistics
         public string EndDt { get; set; }
 
     }
-    public class MarketingSalesStatisticsDtoFoalidator : AbstractValidator<MarketingSalesStatistics>
+    public class MarketingSalesStatisticsDtoFoalidator : AbstractValidator<MarketingSalesStatisticsDto>
     {
         public MarketingSalesStatisticsDtoFoalidator()
         {

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

@@ -501,5 +501,7 @@ namespace OASystem.Domain.ViewModels.Financial
         public List<int> GroupIds { get; set; }
 
         public List<int> DailyPaymentIds { get; set; }
+
+        public List<int> HotelSubIds { get; set; }
     }
 }