Selaa lähdekoodia

部分代码调整

yuanrf 6 kuukautta sitten
vanhempi
commit
0bf934238d

+ 2 - 2
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -5671,8 +5671,8 @@ Group by PriceType ", dto.diId);
                     .And(it => it.VisitDate <= EndDateTime)
                     .And(it => it.IsDel == 0)
                     .And(it => it.UserId == dto.UserId)
-                    .And(it => it.IsConfirm == dto.Confirm)
-                    .And(it => it.IsSeed == dto.Send)
+                    .AndIF(dto.Confirm != -1,it => it.IsConfirm == dto.Confirm)
+                    .AndIF(dto.Send != -1, it => it.IsSeed == dto.Send)
                     .ToExpression();
 
             try

+ 36 - 16
OASystem/OASystem.Infrastructure/Repositories/Groups/CarTouristGuideGroundRepository.cs

@@ -194,8 +194,20 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 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);
+                var carTouristGuides = _sqlSugar.Queryable<Grp_CarTouristGuideGroundReservationsContent>()
+                                             .LeftJoin<Sys_SetData>((a,b) => b.IsDel == 0 && a.SId == b.Id)
+                                             .Where(a => a.IsDel == 0 && a.CTGGRId == dto.Id)
+                                             .Select((a, b) => new CarTouristGuideGroundReservationsContentView {
+                                                 SId = a.SId,
+                                                 Id = a.Id,
+                                                 Count = a.Count,
+                                                 DatePrice = a.DatePrice,
+                                                 Price = a.Price,
+                                                 PriceContent = a.PriceContent,
+                                                 Units = a.Units,
+                                                 SidName = b.Name
+                                             })
+                                             .ToList();
 
                 var weikuanSign = new int[] { 1070, 1071,};
                 TableInitialization.RemoveAll(x => weikuanSign.Contains(x.Id));
@@ -233,6 +245,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             Count = 1,
                             DatePrice = startForTime,
                             SId = item,
+                            SidName = groupResult[item][0].SidName
                         });
                         startForTime = startForTime.AddDays(1);
                     }
@@ -278,21 +291,28 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 }
 
                 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;
-                }
-
-                Grp_CreditCardPayment CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable == 79);
-                CarTouristCreditCardPaymentView _CreditCardPayment = _mapper.Map<CarTouristCreditCardPaymentView>(CreditCardPayment);
 
-                if (_CreditCardPayment != null)
+                var _CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment, Sys_SetData, Sys_SetData>(
+                    (g, s1, s2) => new JoinQueryInfos (
+                        JoinType.Left, g.PayDId == s1.Id,
+                        JoinType.Left, g.PaymentCurrency == s2.Id
+                    ))
+                .Where((g, s1, s2) => g.CId == dto.Id && g.IsDel == 0 && g.CTable == 79)
+                .Select((g, s1, s2) => new CarTouristCreditCardPaymentView
                 {
-                    _CreditCardPayment.PayName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PayDId).Name;
-                    _CreditCardPayment.PaymentCurrencyName = _sqlSugar.Queryable<Sys_SetData>().First(a => a.Id == _CreditCardPayment.PaymentCurrency)?.Name;
-                    if (_CreditCardPayment.OrbitalPrivateTransfer == 0) _CreditCardPayment.OrbitalPrivateTransferStr = "公转";
-                    else _CreditCardPayment.OrbitalPrivateTransferStr = "私转";
-                }
+                    IsAuditGM = g.IsAuditGM,
+                    PayDId = g.PayDId,
+                    PaymentCurrency = g.PaymentCurrency,
+                    Payee = g.Payee,
+                    PayMoney = g.PayMoney,
+                    PayPercentage = g.PayPercentage,
+                    PayName = s1.Name,
+                    PaymentCurrencyName = s2.Name,
+                    OrbitalPrivateTransfer = g.OrbitalPrivateTransfer,
+                    OrbitalPrivateTransferStr = g.OrbitalPrivateTransfer == 0 ? "公转" : "私转"
+                })
+                .First();
+
 
                 Dictionary<string, string> soureDic = new Dictionary<string, string>()
                 {
@@ -754,7 +774,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
                 #region 旧数据处理
                 string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm ss");
                 var ids = carTouristList.Select(x1 => x1.Id);
-                _ = _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservationsContent>().Where(x => x.DiId == dto.DiId && x.CTGGRId == dto.CTGGRId  && !ids.Contains(x.Id)).SetColumns(x => new Grp_CarTouristGuideGroundReservationsContent
+                _ = _sqlSugar.Updateable<Grp_CarTouristGuideGroundReservationsContent>().Where(x => x.DiId == dto.DiId && x.CTGGRId == dto.CTGGRId  && !ids.Contains(x.Id) && x.IsDel == 0).SetColumns(x => new Grp_CarTouristGuideGroundReservationsContent
                 {
                     IsDel = 1,
                     DeleteTime = time,