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

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

leiy 1 рік тому
батько
коміт
d9dc5a4a86

+ 14 - 4
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -2652,7 +2652,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
 
 
             _daiRep.CommitTran();
-            return Ok(JsonView(false, "操作成功"));
+            return Ok(JsonView(true, "操作成功"));
         }
 
         private bool extraCost_editCreditCardPayment(Fin_GroupExtraCostDto_OP costDto)
@@ -2793,9 +2793,10 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
             int endIndex = startIndex + dto.PageSize - 1;
             string sql_data = string.Format(@"Select * From (	
                                                 Select row_number() over (order by f.Id Desc) as RowNumber,f.Id,f.DiId,
-												f.PriceName,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM
+												f.PriceName,f.PriceType,CAST(f.Price as varchar)+' '+s.[Name] as PriceStr,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM
                                                 From Fin_GroupExtraCost f
                                                 Inner Join Grp_CreditCardPayment c On f.Id = c.CId
+                                                Inner Join Sys_SetData s On f.PriceCurrency = s.Id
                                                 Left Join Sys_Users u On f.CreateUserId = u.Id
                                                 Where f.IsDel=0 And c.CTable = 1015 {0}
                                                 ) temp Where RowNumber Between {1} and {2}", sqlWhere, startIndex, endIndex);
@@ -2804,6 +2805,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
 												f.PriceName,f.PriceType,f.Price,f.FilePath,f.CreateUserId,f.CreateTime,c.IsAuditGM
                                                 From Fin_GroupExtraCost f
                                                 Inner Join Grp_CreditCardPayment c On f.Id = c.CId
+                                                Inner Join Sys_SetData s On f.PriceCurrency = s.Id
                                                 Left Join Sys_Users u On f.CreateUserId = u.Id
                                                 Where f.IsDel=0 And c.CTable = 1015 {0}
                                                 ) temp ", sqlWhere);
@@ -2818,6 +2820,14 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
 
                 foreach (var item in dataList)
                 {
+                    DateTime dtTemp_CreateTime;
+                    bool b_ct = DateTime.TryParse(item.CreateTime, out dtTemp_CreateTime);
+                    if (b_ct) {
+                        item.CreateTime = dtTemp_CreateTime.ToString("yyyy-MM-dd HH:mm");
+                    }
+
+
+
                     //费用详细类型
                     if (dic_setData.ContainsKey(item.PriceType))
                     {
@@ -2837,7 +2847,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
                     //系统用户
                     if (dic_user.ContainsKey(item.CreateUserId))
                     {
-                        item.CreateUserIdStr = dic_setData[item.CreateUserId];
+                        item.CreateUserIdStr = dic_user[item.CreateUserId];
                     }
                     else
                     {
@@ -2845,7 +2855,7 @@ Where c.CTable = 1015 And c.IsPay = 1 And f.IsDel = 0 And c.IsDel = 0 And f.DiId
                         if (users != null)
                         {
                             item.CreateUserIdStr = users.CnName;
-                            dic_setData.Add(item.CreateUserId, users.CnName);
+                            dic_user.Add(item.CreateUserId, users.CnName);
                         }
                     }
 

+ 2 - 2
OASystem/OASystem.Domain/Dtos/Groups/CarTouristGuideGroundDto.cs

@@ -98,7 +98,7 @@ namespace OASystem.Domain.Dtos.Groups
         public string Remark { get; set; }
     }
 
-    public class CarTouristGuideGroundContentDto
+    public class CarTouristGuideGroundContentDto : PortDtoBase
     {
         public int UserId { get; set; }
 
@@ -182,7 +182,7 @@ namespace OASystem.Domain.Dtos.Groups
         /// <summary>
         /// 单位
         /// </summary>
-        public int? Units { get; set; }
+        public int Units { get; set; }
 
 
         ///// <summary>

+ 1 - 1
OASystem/OASystem.Domain/Entities/Groups/Grp_CarTouristGuideGroundReservationsContent.cs

@@ -59,6 +59,6 @@ namespace OASystem.Domain.Entities.Groups
         /// 单位
         /// </summary>
         [SugarColumn(ColumnDescription = "单位", IsNullable = true, ColumnDataType = "int")]
-        public int? Units { get; set; }
+        public int Units { get; set; }
     }
 }

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

@@ -14,13 +14,14 @@ namespace OASystem.Domain.ViewModels.Financial
         public string PriceName { get; set; }
         public int PriceType { get; set; }
         public string PriceTypeStr { get; set; }
-        public decimal Price { get; set; }
+        public string PriceStr { get; set; }
         public string FilePath { get; set; }
         public int CreateUserId { get; set; }
         public string CreateUserIdStr { get; set; }
         public string CreateTime { get; set; }
         public int IsAuditGM { get; set; }
         public string IsAuditGMStr { get; set; }
+        
     }
 
     public class Fin_GroupExtraCostViewDataCount

+ 1 - 1
OASystem/OASystem.Domain/ViewModels/Groups/CarTouristCreditCardPaymentView.cs

@@ -86,6 +86,6 @@ namespace OASystem.Domain.ViewModels.Groups
         /// <summary>
         /// 单位
         /// </summary>
-        public int? Units { get; set; }
+        public int Units { get; set; }
     }
 }

+ 136 - 29
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -1,5 +1,7 @@
-using AutoMapper;
+using Aspose.Words.Tables;
+using AutoMapper;
 using NPOI.SS.UserModel;
+using NPOI.Util;
 using OASystem.Domain;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Entities.Financial;
@@ -168,8 +170,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
 
                 //列表初始化
                 List<Sys_SetData> TableInitialization = _sqlSugar.Queryable<Sys_SetData>().Where(a => a.STid == 17 && a.IsDel == 0).ToList();
-                //List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
-                //_TableInitialization= _TableInitialization.OrderBy(a=>a.Name).ToList();
+                List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
 
                 List<Sys_SetData> ssd = _sqlSugar.Queryable<Sys_SetData>().Where(x => x.STid == 78).ToList();
                 List<SetDataInfoView> ssdv = _mapper.Map<List<Sys_SetData>,List<SetDataInfoView>>(ssd);
@@ -190,31 +191,87 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         });
                     }
                 }
-
+                
                 var groupResult = carTouristGuides.GroupBy(x => x.SId).ToDictionary(x => x.Key, x => x.ToList());
                 foreach (var item in groupResult.Keys)
                 {
-                    while (groupResult[item].Count <= day)
+                    #region 倒推初始化逻辑
+                    //while (groupResult[item].Count <= day)
+                    //{
+                    //    groupResult[item] = groupResult[item].OrderByDescending(x => x.DatePrice).ToList();
+                    //    if (groupResult[item][0]?.DatePrice is not null)
+                    //    {
+                    //        groupResult[item].Add(new CarTouristGuideGroundReservationsContentView
+                    //        {
+                    //            DatePrice = groupResult[item][0].DatePrice.ObjToDate().AddDays(1),
+                    //            SId = item,
+                    //            Count = 1,
+                    //        });
+                    //    }
+                    //    else
+                    //    {
+                    //        groupResult[item][0].DatePrice = start;
+                    //    }
+                    //}
+                    #endregion
+
+                    var startForTime = start;
+
+                    var dayResult = new List<CarTouristGuideGroundReservationsContentView>();
+
+                    for (var i = 0; i <= day; i++)
                     {
-                        groupResult[item] = groupResult[item].OrderByDescending(x => x.DatePrice).ToList();
-                        if (groupResult[item][0]?.DatePrice is not null)
+                        dayResult.Add(new CarTouristGuideGroundReservationsContentView
                         {
-                            groupResult[item].Add(new CarTouristGuideGroundReservationsContentView
+                            Count = 1,
+                            DatePrice = startForTime,
+                            SId = item,
+                        });
+                        startForTime = startForTime.AddDays(1);
+                    }
+
+                    if (groupResult[item].Count != day)
+                    {
+
+                        for (var m = 0; m< groupResult[item].Count; m++)
+                        {
+                            for (var m1 = 0; m1 < dayResult.Count; m1++)
                             {
-                                DatePrice = groupResult[item][0].DatePrice.ObjToDate().AddDays(1),
-                                SId = item,
-                                Count = 1,
-                            });
+                                if (groupResult[item][m].DatePrice == dayResult[m1].DatePrice)
+                                {
+                                    dayResult[m1] = groupResult[item][m];
+                                }
+                            }
+                        }
+                    }
+                    else
+                    {
+                        groupResult[item] = groupResult[item].OrderBy(x => x.DatePrice).ToList();
+
+                        if (groupResult[item][0].DatePrice == dayResult[0].DatePrice && groupResult[item][day - 1].DatePrice == dayResult[day - 1].DatePrice)
+                        {
+                            dayResult = groupResult[item];
                         }
                         else
                         {
-                            groupResult[item][0].DatePrice = start;
+                            for (var m = 0; m < groupResult[item].Count; m++)
+                            {
+                                for (var m1 = 0; m1 < dayResult.Count; m1++)
+                                {
+                                    if (groupResult[item][m].DatePrice == dayResult[m1].DatePrice)
+                                    {
+                                        dayResult[m1] = groupResult[item][m];
+                                    }
+                                }
+                            }
                         }
                     }
+
+                    groupResult[item] = dayResult;
                 }
 
-                carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).OrderBy(x=>x.SId).ThenBy(x=>x.DatePrice).ToList();
-                foreach (var item in carTouristGuides.Where(x=>string.IsNullOrWhiteSpace(x.SidName)).ToList())
+                carTouristGuides = groupResult.Values.SelectMany(sublist => sublist).OrderBy(x => x.SId).ThenBy(x => x.DatePrice).ToList();
+                foreach (var item in carTouristGuides.Where(x => string.IsNullOrWhiteSpace(x.SidName)).ToList())
                 {
                     item.SidName = TableInitialization.Find(x => x.Id == item.SId)?.Name;
                 }
@@ -252,6 +309,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 };
 
                 var checkedItem = new List<string>();
+                var checkedItemId = new List<int>();
 
                 if (string.IsNullOrWhiteSpace(grpCarOp.SelectCheck))
                 {
@@ -274,6 +332,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                                 else
                                 {
                                     checkedItem.Add(soureKey);
+                                    checkedItemId.Add(_TableInitialization.Find(x=>x.Name == soureKey)!.Id);
                                 }
                             }
                         }
@@ -282,23 +341,52 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 else
                 {
                     checkedItem = grpCarOp.SelectCheck.Split(",").ToList<string>();
+                    int number = 0;
+                    foreach (var item in checkedItem)
+                    {
+                        if (!int.TryParse(item,out number))
+                        {
+                            checkedItemId.Add(_TableInitialization.Find(x => x.Name == item)!.Id);
+                        }
+                        else
+                        {
+                            checkedItemId.Add(number);
+                        }
+                    }
                 }
 
-                var data = new
+                if(dto.PortType == 1)
                 {
-                    Payment = _Payment,
-                    Delegations = grp_Delegations,
-                    carTouristGuides = carTouristGuides,
-                    CreditCardPayment = _CreditCardPayment,
-                    start,
-                    end,
-                    ssdv,
-                    checkedItem
-                };
-
-                return result = new Result() { Code = 0, Msg = "查询成功",Data=data };
+                    var data = new
+                    {
+                        Payment = _Payment,
+                        Delegations = grp_Delegations,
+                        carTouristGuides = carTouristGuides,
+                        CreditCardPayment = _CreditCardPayment,
+                        start,
+                        end,
+                        ssdv,
+                        checkedItem
+                    };
+
+                    return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
+
+                } else if(dto.PortType == 2)
+                {
+                    var data = new
+                    {
+                        Payment = _Payment,
+                        TableInitialization = _TableInitialization,
+                        carTouristGuides = carTouristGuides,
+                        CreditCardPayment = _CreditCardPayment,
+                        ssdv,
+                        checkedItemId
+                    };
+                    return result = new Result() { Code = 0, Msg = "查询成功", Data = data };
+                }
 
-            }
+                return result = new Result() { Code = -1, Msg = "请传入有效portType" };
+}
             catch (Exception ex)
             {
                 return result = new Result() { Code = -2, Msg = "未知错误" };
@@ -506,7 +594,26 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     DatePrice = item.DatePrice,
                     Count = item.Count,
                 }).ToList();
-                
+
+                //车超时费
+                //餐费和三公经费那个表做完匹配后也放进超支表里
+                //DataTable tb = new DataTable();
+                //tb.Columns.Add("日期",typeof(DateTime));
+                //tb.Columns.Add("费用", typeof(decimal));
+                //var addsTourClientList = new List<Grp_TourClientList>();
+                //var carExtraList = carTouristList.Where(x => x.SId == 982).ToList();
+                //var mealPriceList = carTouristList.Where(x => x.SId == 93 || x.SId == 988 || x.SId == 989).GroupBy(x => x.DatePrice).ToList();
+                //mealPriceList.ForEach(x =>
+                //{
+                //    var row = tb.NewRow();
+                //    row["日期"] = x.Key;
+                //    row["费用"] = x.Sum(x => x.Price);
+                //});
+
+                //三公费用
+                //var cityPrice = carTouristList.Where(x=>)
+
+
                 foreach (var item in carTouristList)
                 {
                    

+ 13 - 0
OASystem/OASystem.Infrastructure/Repositories/Groups/TourClientListRepository.cs

@@ -625,6 +625,19 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     MealSpecialNeeds = item.MealSpecialNeeds,
                     Remark = item.Remark
                 };
+
+
+                //判断现有团组客户名单是否存在该客户
+                var QuerFirstClient = _sqlSugar.Queryable<Grp_TourClientList>().First(x => x.ClientId == _TourClientList.ClientId && x.DiId == _TourClientList.DiId && x.IsDel == 0);
+                if (QuerFirstClient != null)
+                {
+                    QuerFirstClient.IsDel = 1;
+                    QuerFirstClient.DeleteUserId = dto.UserId;
+                    QuerFirstClient.DeleteTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    var UpdateTrue = _sqlSugar.Updateable(QuerFirstClient).UpdateColumns(x => new { x.IsDel,x.DeleteUserId,x.DeleteTime}).ExecuteCommand() > 0;
+                }
+
+
                 var tourClientAdd = await _sqlSugar.Insertable(_TourClientList).ExecuteReturnIdentityAsync();
                 if (tourClientAdd < 0)
                 {