소스 검색

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

yuanrf 9 달 전
부모
커밋
5a6ceacf5f

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

@@ -10390,8 +10390,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;
 
@@ -10419,32 +10421,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;
 

+ 101 - 4
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -26,6 +26,10 @@ using NetTaste;
 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
 {
@@ -37,6 +41,7 @@ namespace OASystem.API.Controllers
     public class StatisticsController : ControllerBase
     {
         private readonly int _decimalPlaces;
+        private readonly IConfiguration _config;
         private readonly IMapper _mapper;
         private readonly SqlSugarClient _sqlSugar;
         private readonly DelegationInfoRepository _groupRep;
@@ -51,9 +56,10 @@ namespace OASystem.API.Controllers
         /// <param name="sqlSugar"></param>
         /// <param name="groupRep"></param>
         /// <param name="setDataRep"></param>
-        public StatisticsController(IMapper mapper, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate, VisitingClientsRepository visitingClientsRep)
+        public StatisticsController(IMapper mapper, IConfiguration config, SqlSugarClient sqlSugar, DelegationInfoRepository groupRep, SetDataRepository setDataRep, TeamRateRepository teamRate, VisitingClientsRepository visitingClientsRep)
         {
             _mapper = mapper;
+            _config = config;
             _groupRep = groupRep;
             _setDataRep = setDataRep;
             _sqlSugar = sqlSugar;
@@ -2917,20 +2923,111 @@ Order By Count Desc");
                                                         55,//  大运会
                                                          };
 
+                var dailypaymentTypeData = await RedisRepository.RedisFactory
+                                                                .CreateRedisRepository()
+                                                                .StringGetAsync<List<int>>("DailypaymentTypeData") ?? new List<int>();
+
                 var _view = await _sqlSugar.Queryable<DailypaymentParentTypeView>()
                                            .Includes(x => x.SubData)
                                            .Where(x => defaultParentIds.Contains(x.Id))
                                            .ToListAsync();
+                _view.ForEach(x =>
+                {
+                    x.SubData.ForEach(y =>
+                    {
+                        int currId = dailypaymentTypeData.Find(z => z == y.Id);
+                        y.IsChecked = currId == 0 ? false : true;
+                    });
+                });
 
-                //return Ok(JsonView(true, "查询成功!", _view, total));
-                return Ok(JsonView(false, "查询失败",_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));
 

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

@@ -353,5 +353,8 @@
         }
       ]
     }
-  ]
+  ],
+  
+  //日付类型Data
+  "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("结束查询日期不能为空!");
+        }
+    
+    }
+
 }

+ 3 - 3
OASystem/OASystem.Domain/Entities/Financial/Fin_ForeignReceivables.cs

@@ -94,19 +94,19 @@ namespace OASystem.Domain.Entities.Financial
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
         public int AddingWay { get; set; }
 
-        
+
         /// <summary>
         /// 审核状态 AddingWay==2该项有值
         /// 0 - 未审核 1 - 审核通过 2 - 审核不通过
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
-        public int Status { get; set; }
+        public int Status { get; set; } = 0;
 
         /// <summary> 
         /// 审核人 AddingWay==2该项有值
         /// </summary>
         [SugarColumn(IsNullable = true, ColumnDataType = "int")]
-        public int Auditor { get; set; } 
+        public int Auditor { get; set; } = 0;
 
         /// <summary>
         /// 审核时间 AddingWay==2该项有值

+ 2 - 0
OASystem/OASystem.Domain/ViewModels/Statistics/DailypaymentView.cs

@@ -31,6 +31,8 @@ namespace OASystem.Domain.ViewModels.Statistics
         public int Id { get; set; }
         public int STid { get; set; }
         public string Name { get; set; }
+
+        public bool IsChecked { get; set; } = false;
     }
 
 }

+ 1 - 0
OASystem/OASystem.Infrastructure/OASystem.Infrastructure.csproj

@@ -12,6 +12,7 @@
     <PackageReference Include="AutoMapper" Version="12.0.0" />
     <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.0" />
     <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
+    <PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
     <PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
     <PackageReference Include="NPOI" Version="2.6.0" />

+ 25 - 5
OASystem/OASystem.Infrastructure/Repositories/Financial/ForeignReceivablesRepository.cs

@@ -372,9 +372,25 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
             int addCount = 0, updateCount = 0;
             if (dto.PortType == 1)
             {
-                List<Fin_ForeignReceivables> _ForeignReceivables = new List<Fin_ForeignReceivables>();
+                //查询值是否更改
+                var selectInfos = await _sqlSugar.Queryable<Fin_ForeignReceivables>().Where(it => it.Diid == dto.DiId && it.Status == 1).ToListAsync();
+
+                List <Fin_ForeignReceivables> _ForeignReceivables = new List<Fin_ForeignReceivables>();
                 foreach (var item in dto.foreignReceivablesInfos)
                 {
+                    int status = 0, auditor = 0;
+                    string auditTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                    var info = selectInfos.Find(x => x.Id == item.Id);
+                    if (info != null)
+                    {
+                        if (info.ItemSumPrice == item.ItemSumPrice)
+                        {
+                            status = info.Status;
+                            auditor = info.Auditor;
+                            auditTime = info.AuditTime;
+                        }
+                    }
+
                     _ForeignReceivables.Add(new Fin_ForeignReceivables()
                     {
                         Diid = dto.DiId,
@@ -389,7 +405,10 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                         AddingWay = item.AddingWay,
                         CreateUserId = dto.UserId,
                         CreateTime = DateTime.Now,
-                        Remark = item.Remark
+                        Remark = item.Remark,
+                        Status = status,
+                        Auditor = auditor,
+                        AuditTime = auditTime
                     });
                 }
                 if (_ForeignReceivables.Count > 0)
@@ -397,9 +416,10 @@ Where ffr.IsDel=0 And ffr.Diid={0}", dto.DiId);
                     var x = _sqlSugar.Storageable(_ForeignReceivables).ToStorage();
                     addCount = x.AsInsertable.ExecuteCommand();       //不存在插入
                     updateCount = x.AsUpdateable.IgnoreColumns(it => new 
-                                    {  it.Status, 
-                                        it.Auditor, 
-                                        it.AuditTime, 
+                                    {  
+                                        //it.Status, 
+                                        //it.Auditor, 
+                                        //it.AuditTime, 
                                         it.CreateUserId, 
                                         it.CreateTime 
                                     }).ExecuteCommand();    //存在更新

+ 6 - 1
OASystem/OASystem.Infrastructure/Tools/AppSettingsHelper.cs

@@ -1,4 +1,8 @@
-namespace OASystem.Infrastructure.Tools;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.Configuration.Memory;
+using MySqlX.XDevAPI;
+
+namespace OASystem.Infrastructure.Tools;
 
 /// <summary>
 /// 配置帮助类
@@ -75,4 +79,5 @@ public class AppSettingsHelper
             return null;
         }
     }
+
 }