Browse Source

团组列表 车导地接 费用名称增加 日期

amigotrip 7 months ago
parent
commit
04fe51507f

+ 74 - 14
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -511,7 +511,7 @@ namespace OASystem.API.Controllers
                                                      ccp.OrbitalPrivateTransfer,sd1.Name As PayWay,ccp.IsPay,u.CnName As Applicant,ctggr.CreateTime
                                                      From Grp_CarTouristGuideGroundReservations ctggr
                                                      Left Join ( Select cggrc.CTGGRId,sd1.Name As PriceName,cggrc.Price,sd2.Name As PriceCurrency,
-                                                                     cggrc.PriceContent
+                                                                        cggrc.DatePrice,cggrc.PriceContent
                                                              From Grp_CarTouristGuideGroundReservationsContent cggrc
                                                              Left Join Sys_SetData sd1 On cggrc.SId = sd1.Id
                                                              Left Join Sys_SetData sd2 On cggrc.Currency = sd2.Id
@@ -582,6 +582,11 @@ namespace OASystem.API.Controllers
                         item.AuditGMDate = Convert.ToDateTime(item.AuditGMDate).ToString("yyyy-MM-dd HH:mm:ss");
                     }
 
+                    if (item.DatePrice != null)
+                    {
+                        item.PriceName = $"{item.PriceName}({Convert.ToDateTime(item.DatePrice).ToString("yyyy-MM-dd")})";
+                    }
+
                     //CTGGRFeeStr += string.Format(@"{0} 总费用:{1} {2}(人民币:{3} CNY 当时支付汇率:{4})\r\n", 
                     //    item.Area, item.AmountPaid.ConvertToDecimal1().ToString("#0.00"), item.PaymentCurrency, item.CNYPrice.ToString("#0.0000"), item.DayRate.ToString("#0.0000"));
                     //CTGGRCNYTotalPrice += item.CNYPrice;
@@ -2993,12 +2998,25 @@ Order By Count Desc");
         /// </summary>
         /// <param name="_dto"></param>
         /// <returns></returns>
-        [HttpPost("DailypaymentTypeDataSave")]
+        [HttpPost("DailypaymentRange")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> DailypaymentRange(DailypaymentTypeDataSaveDto _dto)
+        public async Task<IActionResult> DailypaymentRange(DailypaymentRangeDto _dto)
         {
             #region  参数验证
-            if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg: MsgTips.Port));
+
+            var validator = new DailypaymentRangeDtoValidator();
+            var validationRes = validator.Validate(_dto);
+
+            if (!validationRes.IsValid)
+            {
+                StringBuilder sb = new StringBuilder();
+                foreach (var item in validationRes.Errors)
+                {
+                    sb.AppendLine(item.ErrorMessage);
+                }
+                return Ok(JsonView(false, sb.ToString()));
+            }
+           
 
             PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
             #region 页面操作权限验证
@@ -3010,19 +3028,61 @@ Order By Count Desc");
             #endregion
             if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
             {
-                if (_dto.TypeIds.Count < 1) return Ok(JsonView(false, "请传入需要保存的TypeIds"));
+                DateTime _beginDt = Convert.ToDateTime($"{_dto.BeginDt} 00:00:00"),
+                         _endDt = Convert.ToDateTime($"{_dto.EndDt} 23:59:59");
 
-                var res = await RedisRepository.RedisFactory
-                                               .CreateRedisRepository()
-                                               .StringSetAsync(
-                                                    key: "DailypaymentTypeData",
-                                                    _dto.TypeIds,
-                                                    timeout: null);
-
-                if (!res) return Ok(JsonView(false, "操作失败"));
+                string sqlWhere = string.Format(@" And dfp.CreateTime Between '{0}' And '{1}'",_beginDt,_endDt);
 
+                var dailypaymentTypeData = await RedisRepository.RedisFactory
+                                                                .CreateRedisRepository()
+                                                                .StringGetAsync<List<int>>("DailypaymentTypeData") ?? new List<int>();
+              
+                string sql = string.Format(@"
+Select 
+	dfp.Id,
+	dfp.Instructions,
+	dfp.PriceTypeId,
+	sd1.Name As FeeType,
+	dfp.TransferTypeId,
+	sd2.Name As TransferType,
+	dfp.SumPrice,
+	dfp.FAuditDate,
+	dfp.MAuditDate,
+	dfp.CompanyId,
+	c.CompanyName,
+	dfp.CreateUserId As ApplicantId,
+	u.CnName As Applicant,
+	dfp.CreateTime As ApplicantDt
+From Fin_DailyFeePayment dfp  
+Left Join Sys_Users u On dfp.CreateUserId = u.Id 
+Left Join Sys_SetData sd1 On dfp.TransferTypeId = sd1.Id
+Left Join Sys_Company c On dfp.CompanyId = c.Id
+Left Join Sys_SetData sd2 On dfp.PriceTypeId = sd2.Id
+Where dfp.IsDel = 0 And dfp.IsPay = 1
+",sqlWhere);//--Order By dfp.CreateTime Desc
+
+                RefAsync<int> total = 0;
+                var _view = await _sqlSugar.SqlQueryable<DailyFeePaymentRangeView>(sql)
+                                           //.Includes(x => x.Contents)
+                                           //.ToListAsync();
+                                           .Where(x => x.ApplicantDt >= _beginDt && x.ApplicantDt <= _endDt)
+                                           .WhereIF(dailypaymentTypeData.Count > 0,
+                                                    x => dailypaymentTypeData.Contains(x.PriceTypeId))
+                                           .OrderByDescending(x => x.ApplicantDt)
+                                           .ToPageListAsync(
+                                                pageNumber: _dto.PageIndex,
+                                                pageSize: _dto.PageSize,
+                                                totalNumber: total
+                                                );
+
+                _sqlSugar.ThenMapper(_view, x =>
+                {
+                    x.Contents = _sqlSugar.Queryable<DailyFeePaymentContentView>()
+                                          .SetContext(x1 => x1.DFPId, () => x.Id, x)
+                                          .ToList();
+                });
 
-                return Ok(JsonView(true, "操作成功!"));
+                return Ok(JsonView(true, "操作成功!", _view, total));
             }
             else return Ok(JsonView(false, "操作失败"));
         }

+ 44 - 4
OASystem/OASystem.Domain/Dtos/Statistics/DailypaymentDto.cs

@@ -1,4 +1,5 @@
 using FluentValidation;
+using Google.Protobuf;
 using OASystem.Domain.ViewModels;
 using System;
 using System.Collections.Generic;
@@ -37,15 +38,54 @@ namespace OASystem.Domain.Dtos.Statistics
 
     }
 
+    /// <summary>
+    /// dto验证
+    /// </summary>
     public class DailypaymentRangeDtoValidator : AbstractValidator<DailypaymentRangeDto>
     {
         public DailypaymentRangeDtoValidator()
         {
-            RuleFor(x => x.BeginDt).NotEmpty().WithMessage("开始查询日期不能为空!");
-            RuleFor(x => x.EndDt).NotEmpty().WithMessage("结束查询日期不能为空!");
-            RuleFor(x => x.Type).NotEmpty().WithMessage("结束查询日期不能为空!");
+            RuleFor(x => x.PortType).InclusiveBetween(from: 1, to: 3)
+                                    .WithMessage(MsgTips.Port);
+            RuleFor(x => x.PageIndex).Must(x => x > 0)
+                                     .WithMessage("PageIndex不能小于1");
+            RuleFor(x => x.PageSize).Must(x => x > 0)
+                                    .WithMessage("PageSize不能小于1");
+            RuleFor(x => x.BeginDt).NotEmpty()
+                                   .WithMessage("开始查询日期不能为空!")
+                                   .Must(IsDate)
+                                   .WithMessage("日期格式不正确!例如:2024-07-17");
+            RuleFor(x => x.EndDt).NotEmpty()
+                                 .WithMessage("结束查询日期不能为空!")
+                                 .Must(IsDate)
+                                 .WithMessage("日期格式不正确!例如:2024-12-31")
+                                 .Must(ConfirmDt)
+                                 .WithMessage("开始日期不能大于结束日期!");
+            RuleFor(x => x.Type).InclusiveBetween(from: 1, to: 2)
+                                .WithMessage("请输入正确的范围;1 数据View 2 excel!"); 
+
+        }
+
+        private bool IsDate(string date)
+        {
+            return  DateTime.TryParse(date, out _);
+        }
+
+        private bool ConfirmDt(DailypaymentRangeDto dto, string endDt)
+        {
+            DateTime _beginDt, _endDt;
+            if (DateTime.TryParse(dto.BeginDt, out _beginDt)) 
+            {
+                if (DateTime.TryParse(endDt, out _endDt))
+                {
+                    if (_beginDt < _endDt)
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
         }
-    
     }
 
 }

+ 1 - 0
OASystem/OASystem.Domain/Entities/Groups/Grp_DelegationInfo.cs

@@ -133,6 +133,7 @@ namespace OASystem.Domain.Entities.Groups
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int IsSure { get; set; }
+
         /// <summary>
         /// 预算成本时间
         /// </summary>

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

@@ -510,4 +510,56 @@ namespace OASystem.Domain.ViewModels.Financial
 
         public List<int> HotelSubIds { get; set; }
     }
+
+    #region 日付报表
+
+    [SqlSugar.SugarTable("Fin_DailyFeePayment")]
+    public class DailyFeePaymentRangeView
+    {
+
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        public string Instructions { get; set; }
+        public int PriceTypeId { get; set; }
+        public string FeeType { get; set; }
+        public int TransferTypeId { get; set; }
+        public string TransferType { get; set; }
+        public decimal SumPrice { get; set; }
+        public DateTime FAuditDate { get; set; }
+        public DateTime MAuditDate { get; set; }
+        public int CompanyId { get; set; }
+        public string CompanyName { get; set; }
+        public int ApplicantId { get; set; }
+        public string Applicant { get; set; }
+        public DateTime ApplicantDt { get; set; }
+
+        [Navigate(NavigateType.OneToMany, nameof(DailyFeePaymentContentView.DFPId))]//BookA表中的studenId
+        public List<DailyFeePaymentContentView> Contents { get; set; }
+    }
+
+
+    [SqlSugar.SugarTable("Fin_DailyFeePaymentContent")]
+    public class DailyFeePaymentContentView
+    {
+
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+
+        public int DFPId { get; set; }
+
+        public string PriceName { get; set; }
+
+        public int Quantity { get; set; }
+
+        public decimal Price { get; set; }
+
+        public decimal ItemTotal { get; set; }
+
+        public string Remark { get; set; }
+
+        //public int IsDel { get; set; }
+    }
+    
+
+    #endregion
 }

+ 5 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/GroupStatementView.cs

@@ -798,6 +798,11 @@ namespace OASystem.Domain.ViewModels.Statistics
         /// </summary>
         public decimal BalancePayment { get; set; } = 0.00M;
 
+        /// <summary>
+        /// 消费日期
+        /// </summary>
+        public DateTime? DatePrice { get; set; }
+
         /// <summary>
         /// 当时汇率
         /// </summary>