amigotrip 7 months ago
parent
commit
8a7496d186

+ 3 - 7
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -10326,8 +10326,10 @@ ORDER by  gctggrc.id DESC
             dt.TableName = "ViewMyHotelReservations";
             designer.SetDataSource(dt);
             designer.Process();
-            string fileName = ($"HotelReservation/{groupInfo.TeamName}_酒店预订成本_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls").Replace(":", "");
+
+            string fileName = $"HotelReservation/{groupInfo.TeamName.Replace("/","").Replace(@"\", "").Trim()}_酒店预订成本_{ DateTime.Now.ToString("yyyyMMddHHmmss")}.xls";
             string serverPath = AppSettingsHelper.Get("ExcelBasePath") + fileName;
+          
             designer.Workbook.Save(serverPath);
             string rst = AppSettingsHelper.Get("ExcelBaseUrl") + AppSettingsHelper.Get("ExcelFtpPath") + fileName;
 
@@ -10355,32 +10357,26 @@ ORDER by  gctggrc.id DESC
                 bool containsDigitButNotZero2 = !doubleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
                 if (containsDigitButNotZero2) doubleDel = false;
 
-
                 string suiteStr = item["SuiteRoomPrice"].ToString();
                 bool containsDigitButNotZero3 = !singleStr.StartsWith("0") && Regex.IsMatch(doubleStr, @"[1-9]");
                 if (containsDigitButNotZero3) suiteDel = false;
 
-
                 string otherStr = item["OtherRoomPrice"].ToString();
                 bool containsDigitButNotZero4 = !otherStr.StartsWith("0") && Regex.IsMatch(otherStr, @"[1-9]");
                 if (containsDigitButNotZero4) otherDel = false;
 
-
                 string zcStr = item["BreakfastPrice"].ToString();
                 bool containsDigitButNotZero5 = !zcStr.StartsWith("0") && Regex.IsMatch(zcStr, @"[1-9]");
                 if (containsDigitButNotZero5) zcDel = false;
 
-
                 string dsStr = item["GovernmentRent"].ToString();
                 bool containsDigitButNotZero6 = !dsStr.StartsWith("0") && Regex.IsMatch(dsStr, @"[1-9]");
                 if (containsDigitButNotZero6) dsDel = false;
 
-
                 string cssStr = item["CityTax"].ToString();
                 bool containsDigitButNotZero7 = !cssStr.StartsWith("0") && Regex.IsMatch(cssStr, @"[1-9]");
                 if (containsDigitButNotZero7) cssDel = false;
 
-
                 string cpStr = item["ConsumptionPatterns"].ToString();
                 if (!string.IsNullOrEmpty(cpStr)) cpDel = false;
 

+ 88 - 7
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -27,6 +27,9 @@ using OASystem.Domain.ViewModels.QiYeWeChat;
 using NPOI.POIFS.Crypt.Dsig;
 using EyeSoft.SequentialIdentity;
 using Microsoft.Extensions.Configuration;
+using System.Text.Json;
+using OASystem.RedisRepository;
+using OASystem.RedisRepository.RedisAsyncHelper;
 
 namespace OASystem.API.Controllers
 {
@@ -2920,13 +2923,10 @@ Order By Count Desc");
                                                         55,//  大运会
                                                          };
 
-                //更改appsettings 值
-                //AppSettingsHelper.UpdateIntList("Dailypayment",new List<int>() { 666 });
-                //var listConfig = _config.GetSection("Dailypayment").GetValue<List<int>>();
-                //listConfig.Add(666);
+                var dailypaymentTypeData = await RedisRepository.RedisFactory
+                                                                .CreateRedisRepository()
+                                                                .StringGetAsync<List<int>>("DailypaymentTypeData") ?? new List<int>();
 
-                //读取appsettings json DailypaymentTypeData 配置
-                List<int> dailypaymentTypeData = AppSettingsHelper.Get<int>("Dailypayment");
                 var _view = await _sqlSugar.Queryable<DailypaymentParentTypeView>()
                                            .Includes(x => x.SubData)
                                            .Where(x => defaultParentIds.Contains(x.Id))
@@ -2940,13 +2940,94 @@ Order By Count Desc");
                     });
                 });
 
-                return Ok(JsonView(true, "查询成功!", _view));
+                return Ok(JsonView(true, "查询成功!", _view, _view.Count));
             }
             else
             {
                 return Ok(JsonView(false, "查询失败"));
             }
         }
+
+
+        /// <summary>
+        /// 日付类型数据 Save
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost("DailypaymentTypeDataSave")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DailypaymentTypeDataSave(DailypaymentTypeDataSaveDto _dto)
+        {
+            #region  参数验证
+            if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg: MsgTips.Port));
+
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+            #region 页面操作权限验证
+            //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+
+            //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
+            #endregion
+
+            #endregion
+            if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
+            {
+                if (_dto.TypeIds.Count < 1) return Ok(JsonView(false, "请传入需要保存的TypeIds"));
+
+                var res = await RedisRepository.RedisFactory
+                                               .CreateRedisRepository()
+                                               .StringSetAsync(
+                                                    key:"DailypaymentTypeData",
+                                                    _dto.TypeIds,
+                                                    timeout:null );
+
+                if (!res) return Ok(JsonView(false, "操作失败"));
+
+
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            else return Ok(JsonView(false, "操作失败"));
+        }
+
+        /// <summary>
+        /// 日付数据列表
+        /// </summary>
+        /// <param name="_dto"></param>
+        /// <returns></returns>
+        [HttpPost("DailypaymentTypeDataSave")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> DailypaymentRange(DailypaymentTypeDataSaveDto _dto)
+        {
+            #region  参数验证
+            if (_dto.PortType < 1 || _dto.PortType > 3) return Ok(JsonView(false, msg: MsgTips.Port));
+
+            PageFunAuthViewBase pageFunAuthView = new PageFunAuthViewBase();
+            #region 页面操作权限验证
+            //pageFunAuthView = await GeneralMethod.PostUserPageFuncDatas(_dto.UserId, _dto.PageId);
+
+            //if (pageFunAuthView.CheckAuth == 0) return Ok(JsonView(false, "您没有查看权限"));
+            #endregion
+
+            #endregion
+            if (_dto.PortType == 1 || _dto.PortType == 2 || _dto.PortType == 3) // web/Android/IOS
+            {
+                if (_dto.TypeIds.Count < 1) return Ok(JsonView(false, "请传入需要保存的TypeIds"));
+
+                var res = await RedisRepository.RedisFactory
+                                               .CreateRedisRepository()
+                                               .StringSetAsync(
+                                                    key: "DailypaymentTypeData",
+                                                    _dto.TypeIds,
+                                                    timeout: null);
+
+                if (!res) return Ok(JsonView(false, "操作失败"));
+
+
+                return Ok(JsonView(true, "操作成功!"));
+            }
+            else return Ok(JsonView(false, "操作失败"));
+        }
+
+
         #endregion
     }
 }

+ 5 - 0
OASystem/OASystem.Api/DailypaymentAppsettings.json

@@ -0,0 +1,5 @@
+{
+  //"Dailypayment": [
+
+  //]
+}

+ 1 - 0
OASystem/OASystem.Api/Program.cs

@@ -37,6 +37,7 @@ var basePath = AppContext.BaseDirectory;
 var _config = new ConfigurationBuilder()
                  .SetBasePath(basePath)
                  .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+                 .AddEnvironmentVariables()
                  .Build();
 builder.Services.AddSingleton(new AppSettingsHelper(_config));
 

+ 1 - 3
OASystem/OASystem.Api/appsettings.json

@@ -356,7 +356,5 @@
   ],
   
   //日付类型Data
-  "Dailypayment": [
-
-  ]
+  "Dailypayment": "666,667"
 }

+ 35 - 1
OASystem/OASystem.Domain/Dtos/Statistics/DailypaymentDto.cs

@@ -1,4 +1,6 @@
-using System;
+using FluentValidation;
+using OASystem.Domain.ViewModels;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -14,4 +16,36 @@ namespace OASystem.Domain.Dtos.Statistics
     { 
         
     }
+
+    public class DailypaymentTypeDataSaveDto : PortDtoBase
+    {
+        public List<int> TypeIds { get; set; }
+
+    }
+
+    public class DailypaymentRangeDto : DtoBase
+    {
+        public string BeginDt { get; set; }
+
+        public string EndDt { get; set; }
+
+        /// <summary>
+        /// 类型Data
+        /// 1 数据 2 excel
+        /// </summary>
+        public int Type { get; set; }
+
+    }
+
+    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("结束查询日期不能为空!");
+        }
+    
+    }
+
 }