Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 3 days ago
parent
commit
9ba089e8e2

+ 49 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -19848,6 +19848,55 @@ ORDER BY
             return Ok(await _restaurantRep.ItemAsync(portType,groupId));
         }
 
+        /// <summary>
+        /// 团组相关餐厅信息
+        /// List
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> RestaurantList(RestaurantItemDto dto)
+        {
+            int portType = dto.PortType,
+                groupId = dto.GroupId;
+            if (!SharingStaticData.PortTypes.Contains(portType)) return Ok(JsonView(false, MsgTips.Port));
+            if (groupId < 1) return Ok(JsonView(false, MsgTips.DiId));
+
+            var sql = string.Format(@" SELECT
+  ri.Id,
+  ri.GroupId,
+  ri.Date,
+  ri.StartTime,
+  ri.EndTime,
+  CASE WHEN ri.Type = 1 THEN '早餐'
+  WHEN ri.Type = 2 THEN '午餐'
+  WHEN ri.Type = 3 THEN '晚餐'
+  ELSE '其他'
+  END AS 'Type',
+  ri.Name,
+  ri.Address,
+  ri.Tel,
+  ri.Remark,
+  ri.CreateTime,
+  u.CnName AS CreateUserName
+FROM
+  Grp_RestaurantInfo ri
+  LEFT JOIN Sys_Users u ON ri.CreateUserId = u.Id
+WHERE
+  ri.IsDel = 0
+  AND ri.GroupId = {0}
+ORDER BY
+  ri.Date ASC
+", groupId);
+
+            var infos = await _sqlSugar.SqlQueryable<RestaurantItemView>(sql).ToListAsync();
+
+            if (!infos.Any()) Ok(JsonView(false, "数据未填写!"));
+
+            return Ok(JsonView(infos));
+        }
+
         /// <summary>
         /// 团组相关餐厅信息
         /// Info

+ 37 - 3
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -28,6 +28,7 @@ using OASystem.Infrastructure.Repositories.Groups;
 using StackExchange.Redis;
 using System;
 using System.Data;
+using System.Runtime.Intrinsics.Arm;
 using TencentCloud.Ocr.V20181119.Models;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 using TypeInfo = OASystem.Domain.ViewModels.Statistics.TypeInfo;
@@ -7931,9 +7932,43 @@ GROUP BY
 ORDER BY
   CNYTotal ASC", beginDt, endDt);
 
-            var dailyItems = await _sqlSugar.SqlQueryable<DailyInfo>(dailySql).ToArrayAsync();
+            //var dailyItems = await _sqlSugar.Queryable<Fin_DailyFeePayment, Sys_SetData, Sys_SetDataType, Sys_Company>((dfp, sd, sdt, c) =>
+            //    new JoinQueryInfos(
+            //        JoinType.Left, dfp.PriceTypeId == sd.Id,
+            //        JoinType.Left, sd.STid == sdt.Id,
+            //        JoinType.Left, dfp.CompanyId == c.Id
+            //     ))
+                
+            //    .Select((dfp, sd, sdt, c) => new DailyInfo()
+            //     {
+            //         Id = dfp.Id,
+            //         PriceParentTypeId = sdt.Id,
+            //         PriceParentTypeName = sdt.Name,
+            //         PriceTypeId = sd.Id,
+            //         PriceTypeName = sd.Name,
+            //         CompanyName = c.CompanyName,
+            //         Instructions = dfp.Instructions,
+            //         CNYTotal = dfp.SumPrice,
+            //         PriceInfos = SqlSugar.SqlFunc.Subqueryable<Fin_DailyFeePaymentContent>()
+            //                 .Where(x => x.IsDel == 0 && dfp.Id == x.DFPId)
+            //                 .Select(x => new DailyPriceInfo()
+            //                 {
+            //                     Id = x.Id,
+            //                     DFPId = x.DFPId,
+            //                     PriceName = x.PriceName,
+            //                     Price = x.Price,
+            //                     Quantity = x.Quantity,
+            //                     ItemTotal = x.ItemTotal,
+            //                     Remark = x.Remark
+            //                 }).ToList()
+            //     })
+            //    .ToListAsync();
+
+           // var
+
+
             view.GroupItems = groupItems;
-            view.DailyItems = dailyItems;
+            //view.DailyItems = dailyItems;
             return view;
         }
 
@@ -8078,7 +8113,6 @@ ORDER BY
             //51    其他费用
             var feeTypeDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && new int[] { 48, 49, 90, 50, 51 }.Contains(x.Id)).ToListAsync();
 
-
             if (excelType == 1)
             {
                 //团组收款、成本、利润 合计

+ 54 - 0
OASystem/OASystem.Domain/ViewModels/Groups/RestaurantView.cs

@@ -59,4 +59,58 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public string Remark { get; set; }
     }
+
+    public class RestaurantItemView
+    {
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 团组Id
+        /// </summary>
+        public int GroupId { get; set; }
+
+        /// <summary>
+        /// 用餐日期(2024-12-31)
+        /// </summary>
+        public string Date { get; set; }
+
+        /// <summary>
+        ///  用餐开始时间(08:00)
+        /// </summary>
+        public string StartTime { get; set; }
+
+        /// <summary>
+        ///  用餐结束时间(10:00)
+        /// </summary>
+        public string EndTime { get; set; }
+
+        /// <summary>
+        /// 用餐类型(1:早餐; 2:午餐; 3:晚餐;)
+        /// </summary>
+        public string Type { get; set; }
+
+        /// <summary>
+        /// 餐厅名称
+        /// </summary>
+        public string Name { get; set; }
+
+        /// <summary>
+        /// 餐厅电话
+        /// </summary>
+        public string Tel { get; set; }
+
+        /// <summary>
+        /// 餐厅地址
+        /// </summary>
+        public string Address { get; set; }
+
+        /// <summary>
+        /// 其他信息
+        /// </summary>
+        public string Remark { get; set; }
+
+        public DateTime CreateTime { get; set; }
+
+        public string CreateUserName { get; set; }
+    }
 }

+ 24 - 2
OASystem/OASystem.Domain/ViewModels/Statistics/CorporateProfitViews.cs

@@ -1,4 +1,5 @@
-using System;
+using OASystem.Domain.Entities.Financial;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -19,9 +20,30 @@ namespace OASystem.Domain.ViewModels.Statistics
 
     public class DailyInfo
     {
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        public int PriceParentTypeId { get; set; }
+        public string PriceParentTypeName { get; set; }
+        public int PriceTypeId { get; set; }
+        public string PriceTypeName { get; set; }
         public string CompanyName { get; set; }
-
+        public string Instructions { get; set; }
         public decimal CNYTotal { get; set; }
+        [Navigate(NavigateType.OneToMany, nameof(DailyPriceInfo.DFPId))]
+        public List<DailyPriceInfo> PriceInfos { get; set; }
+    }
+
+    public class DailyPriceInfo
+    {
+
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        public int DFPId { get; set; }
+        public string PriceName { get; set; }
+        public decimal Quantity { get; set; }
+        public decimal Price { get; set; }
+        public decimal ItemTotal { get; set; }
+        public string Remark { get; set; }
     }
 
     public class CorporateProfitInfo

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/CustomersRepository.cs

@@ -379,7 +379,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
             c.PayPercentage = 100;
             c.CTable = 82;
             c.CId = id;
-            c.IsAuditGM = 3;
+            c.IsAuditGM = 0;
             c.PayMoney = cus.InsuranceCosts;
             c.PaymentCurrency = cus.Currency;
 

+ 1 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -333,7 +333,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         //操作权限验证 只有创建人可修改
                         var info = await _sqlSugar.Queryable<Grp_EnterExitCost,Sys_Users>((eec,u) => new JoinQueryInfos(JoinType.Left,eec.CreateUserId == u.Id))
-                            .Where(it => it.IsDel == 0 && it.Id == enterExitCost.Id)
+                            .Where((eec, u) => eec.IsDel == 0 && eec.Id == enterExitCost.Id)
                             .Select((eec, u) => new { eec.CreateUserId,u.CnName })
                             .FirstAsync();
                         if (info.CreateUserId != dto.UserId)

+ 41 - 34
OASystem/OASystem.Infrastructure/Repositories/Groups/FeeAuditRepository.cs

@@ -43,27 +43,42 @@ namespace OASystem.Infrastructure.Repositories.Groups
             var stids = new List<int>() { 17, 66, 91 };
             var setData = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && stids.Contains(x.STid)).ToList();
             string _teamCurrency = string.Empty;
-           
-            var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First();
-            if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; }
-            _teamCurrency = groupInfo.Currency;
-            decimal _teamRate = groupInfo.Rate;
-            //币种验证  统一为currencycode三字码
-            if (int.TryParse(_teamCurrency,out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? "";
 
-            string costContentSql = $"Select * From Grp_GroupCost";
-            var costContents =  _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList();
-            if (costContents.Count < 1) { _view.Msg = $"团组成本信息未填写!"; return _view; }
-
-            //处理 成本详细信息 日期为空
-            for (int i = 0; i < costContents.Count; i++)
+            decimal _teamRate = 0.00M;
+            var costContents = new List<GroupCostAuditView>();
+            if (feeType != 4)
             {
-                if (string.IsNullOrEmpty( costContents[i].Date))
+                var groupInfo = _sqlSugar.Queryable<Grp_GroupCostParameter>().Where(x => x.IsDel == 0 && x.DiId == diId).First();
+                if (groupInfo == null) { _view.Msg = $"团组成本信息未填写!"; return _view; }
+                _teamCurrency = groupInfo.Currency;
+                _teamRate = groupInfo.Rate;
+
+                //币种验证  统一为currencycode三字码
+                if (int.TryParse(_teamCurrency, out int currency)) _teamCurrency = setData.Find(x => x.Id == currency)?.Name ?? "";
+
+                string costContentSql = $"Select * From Grp_GroupCost";
+                costContents = _sqlSugar.SqlQueryable<GroupCostAuditView>(costContentSql).Where(x => x.IsDel == 0 && x.Diid == diId).ToList();
+
+                if (costContents.Count < 1) { _view.Msg = $"团组成本信息未填写!"; return _view; }
+
+                //处理 成本详细信息 日期为空
+                for (int i = 0; i < costContents.Count; i++)
                 {
-                    int index = i - 1;
-                    if (index >= 0)
+                    if (string.IsNullOrEmpty(costContents[i].Date))
+                    {
+                        int index = i - 1;
+                        if (index >= 0)
+                        {
+                            costContents[i].Date = costContents[index].Date;
+                            var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
+                            if (dtBool)
+                            {
+                                costContents[i].CurrTime = _dateTime;
+                            }
+                        }
+                    }
+                    else
                     {
-                        costContents[i].Date = costContents[index].Date;
                         var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
                         if (dtBool)
                         {
@@ -71,16 +86,8 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         }
                     }
                 }
-                else
-                {
-                    var dtBool = DateTime.TryParse(costContents[i].Date, out DateTime _dateTime);
-                    if (dtBool)
-                    {
-                        costContents[i].CurrTime = _dateTime;
-                    }
-                }
             }
-
+            
             if (feeType == 1)
             {
                 //1089	对冲账或其他 不在审核范围
@@ -374,7 +381,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var currModule = 98; //其他款项
                 int groupSize = 0; // 团组人数
                 var groupDetails = await _sqlSugar.Queryable<Grp_DelegationInfo>().Where(x => x.IsDel == 0 && x.Id == diId).FirstAsync();
-                if (groupInfo != null) groupSize = groupDetails.VisitPNumber;
+                if (groupDetails != null) groupSize = groupDetails.VisitPNumber;
 
                 decimal groupCostCNYTotal = costContents.Sum(x => x.TeFee) * _teamRate * groupSize; //团组成本出行物资总金额
                 if (groupCostCNYTotal <= 0.00M)
@@ -512,17 +519,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     if (auditCcpIds.Any())
                     {
                         var ccpUpd = _sqlSugar.Updateable<Grp_CreditCardPayment>()
-                       .SetColumns(it => it.IsAuditGM == 0)
-                       .SetColumns(it => it.AuditGMOperate == 0)
-                       .SetColumns(it => it.AuditGMDate == "")
-                       .Where(s => auditCcpIds.Contains(s.Id))
-                       .ExecuteCommand();
+                           .SetColumns(it => it.IsAuditGM == 0)
+                           .SetColumns(it => it.AuditGMOperate == 0)
+                           .SetColumns(it => it.AuditGMDate == string.Empty)
+                           .Where(s => auditCcpIds.Contains(s.Id))
+                           .ExecuteCommand();
                     }
                 }
 
                 #endregion
 
-                var insuranceCostData = insuranceCostData1.Where(x => insuranceType.Contains(x.Iid)).ToList();
+                //var insuranceCostData = insuranceCostData1.Where(x => insuranceType.Contains(x.Iid)).ToList();
+                var insuranceCostData = insuranceCostData1.ToList();
                 var currInsuranceInfo = insuranceCostData.Where(x => x.Id == dataId).FirstOrDefault();
                 if (!insuranceCostData.Any() && currInsuranceInfo == null)
                 {
@@ -553,7 +561,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 var schengenCost = insuranceCountryCostData.Where(x => schengenCountry.Contains(x.CountryName)).Sum(x => x.Cost); // 申根国费用
                 var unSchengenCost = unSchengenCountry.Count() * 35; // 非申根国费用
 
-
                 var groupBudgetCost = (schengenCost + unSchengenCost) * groupPeopleNum;
                 var groupActialCost = insuranceCostData.Sum(x => x.CNYPrice);
 

+ 29 - 19
OASystem/OASystem.Infrastructure/Repositories/Groups/RestaurantRepository.cs

@@ -78,25 +78,35 @@ namespace OASystem.Infrastructure.Repositories.Groups
             if (!SharingStaticData.PortTypes.Contains(portType)) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "端口类型错误!" };
             if (groupId < 1) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = MsgTips.DiId };
 
-            var infos = await _sqlSugar
-                .Queryable<Grp_RestaurantInfo, Sys_Users>((pi, u) => new JoinQueryInfos(JoinType.Left, pi.CreateUserId == u.Id))
-                .Where((pi, u) => pi.IsDel == 0 && pi.GroupId == groupId)
-                .OrderByDescending((pi, u) => pi.Date)
-                .Select((pi, u) => new
-                {
-                    pi.Id,
-                    //pi.GroupId,
-                    pi.Date,
-                    pi.StartTime,
-                    pi.EndTime,
-                    Type = pi.Type == 1 ? "早餐" : pi.Type == 2 ? "午餐" : pi.Type == 3 ? "晚餐" : "其他",
-                    pi.Name,
-                    pi.Address,
-                    pi.Tel,
-                    pi.Remark
-                })
-                .OrderByDescending(x => x.Date) 
-                .ToListAsync();
+            var sql = string.Format(@" SELECT
+  ri.Id,
+  ri.GroupId,
+  ri.Date,
+  ri.StartTime,
+  ri.EndTime,
+  CASE WHEN ri.Type = 1 THEN '早餐'
+  WHEN ri.Type = 2 THEN '午餐'
+  WHEN ri.Type = 3 THEN '晚餐'
+  ELSE '其他'
+  END AS 'Type',
+  ri.Name,
+  ri.Address,
+  ri.Tel,
+  ri.Remark,
+  ri.CreateTime,
+  u.CnName AS CreateUserName
+FROM
+  Grp_RestaurantInfo ri
+  LEFT JOIN Sys_Users u ON ri.CreateUserId = u.Id
+WHERE
+  ri.IsDel = 0
+  AND ri.GroupId = {0}
+ORDER BY
+  ri.Date ASC
+", groupId);
+
+            var infos = await _sqlSugar.SqlQueryable<RestaurantItemView>(sql).ToListAsync();
+
             if (!infos.Any()) return new JsonView() { Code = StatusCodes.Status400BadRequest, Msg = "数据未填写!",Data = Array.Empty<dynamic>() };
 
             return new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功!", Data = infos };