Browse Source

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

leiy 11 months ago
parent
commit
19d8d9e531

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

@@ -169,6 +169,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 //List<SetDataInfoView> _TableInitialization = _mapper.Map<List<SetDataInfoView>>(TableInitialization);
                 //_TableInitialization= _TableInitialization.OrderBy(a=>a.Name).ToList();
 
+                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);
+
                 List<Grp_CarTouristGuideGroundReservationsContent> grp_CarTouristsContent = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a => a.IsDel == 0 && a.CTGGRId == dto.Id).ToList();
                 List<CarTouristGuideGroundReservationsContentView> carTouristGuides = _mapper.Map<List<CarTouristGuideGroundReservationsContentView>>(grp_CarTouristsContent);
 
@@ -233,6 +236,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     CreditCardPayment = _CreditCardPayment,
                     start,
                     end,
+                    ssdv,
                 };
 
                 return result = new Result() { Code = 0, Msg = "查询成功",Data=data };
@@ -425,30 +429,27 @@ namespace OASystem.Infrastructure.Repositories.Groups
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        public async  Task<Result> OpCarTouristGuideGroundContent(OpCarTouristGuideGroundContentDto dto)
+        public async Task<Result> OpCarTouristGuideGroundContent(OpCarTouristGuideGroundContentDto dto)
         {
             Result result = new Result() { Code = -2, Msg = "未知错误" };
             try
             {
                 BeginTran();
-                List<Grp_CarTouristGuideGroundReservationsContent> carTouristList = new List<Grp_CarTouristGuideGroundReservationsContent>();
-                foreach (var item in dto.OPContentList)
+                List<Grp_CarTouristGuideGroundReservationsContent> carTouristList = dto.OPContentList.Select(item => new Grp_CarTouristGuideGroundReservationsContent
                 {
-                    Grp_CarTouristGuideGroundReservationsContent s = new Grp_CarTouristGuideGroundReservationsContent();
-                    s.Id= item.Id;
-                    s.DiId = dto.DiId;
-                    s.CTGGRId = dto.CTGGRId;
-                    s.SId = item.SId;
-                    s.Price=item.Price;
-                    s.PriceContent = item.priceContent;
-                    s.Currency = dto.Currency;
-                    //s.Remark=item.Remark;
-                    s.CreateUserId = dto.CreateUserId;
-                    s.Units = item.Units;
-                    s.DatePrice = item.DatePrice;
-                    s.Count = item.Count;
-                    carTouristList.Add(s);
-                }
+                    Id = item.Id,
+                    DiId = dto.DiId,
+                    CTGGRId = dto.CTGGRId,
+                    SId = item.SId,
+                    Price = item.Price,
+                    PriceContent = item.priceContent,
+                    Currency = dto.Currency,
+                    CreateUserId = dto.CreateUserId,
+                    Units = item.Units,
+                    DatePrice = item.DatePrice,
+                    Count = item.Count,
+                }).ToList();
+                
                 foreach (var item in carTouristList)
                 {
                    
@@ -457,7 +458,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     {
                         int id = await _sqlSugar.Insertable(item).ExecuteReturnIdentityAsync();
                         if (id == 0)
-                        {
+                        { 
                             RollbackTran();
                             return result = new Result() { Code = -2, Msg = "添加失败" };
                         }
@@ -483,12 +484,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
                 //修改C表数据
                 List<Grp_CarTouristGuideGroundReservationsContent> carTouristListEnd = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>().Where(a=>a.DiId==dto.DiId && a.CTGGRId==dto.CTGGRId && a.IsDel==0).ToList();
-                Grp_CreditCardPayment c=new Grp_CreditCardPayment();
+                Grp_CreditCardPayment c = new Grp_CreditCardPayment();
                 c.PaymentCurrency = dto.Currency;
-                foreach (var item in carTouristListEnd)
-                {
-                    c.PayMoney += item.Price;
-                }
+                c.PayMoney = carTouristListEnd.Sum(x => x.Price);
                 c.PayPercentage = dto.PayPercentage;
                 c.ConsumptionDate= DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 c.CTable = 79;
@@ -536,7 +534,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         IsPay = c.IsPay,
                         RMBPrice = c.RMBPrice,
                         DayRate = c.DayRate,
+
                     }).ExecuteCommandAsync();
+
                     if (CTable == 0)
                     {
                         RollbackTran();
@@ -554,11 +554,11 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
                 int CarTouristGuideCTable = await _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservations>().Where(a => a.Id == dto.CTGGRId && a.DiId == dto.DiId).SetColumns(a => new Grp_CarTouristGuideGroundReservations
                 {
-                    
-                CId=dto.Currency,
-                ServiceQuotedPrice=c.PayMoney,
-                OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
+                    CId = dto.Currency,
+                    ServiceQuotedPrice = c.PayMoney,
+                    OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer,
                 }).ExecuteCommandAsync();
+
                 if (CarTouristGuideCTable == 0)
                 {
                     RollbackTran();
@@ -567,10 +567,9 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 result = new Result() { Code =0, Msg = "保存成功" };
                 CommitTran();
             }
-            catch (Exception)
+            catch (Exception ex)
             {
                 return result = new Result() { Code = -2, Msg = "未知错误" };
-                throw;
             }
             return result;
         }