Browse Source

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

yuanrf 6 months ago
parent
commit
55c9d05a44

+ 0 - 1
OASystem/OASystem.Api/Controllers/AuthController.cs

@@ -112,7 +112,6 @@ namespace OASystem.API.Controllers
 
                 if (expDt >= createZebraTime)  //超时重新获取token
                 {
-                    //authorToken = await GeneralMethod.GetToken(_config, dto.Number, uId,uName, createZebraTime);
                     authorToken = await JwtHelper.IssueJwtAsync(new TokenModelJwt() { UserId = uId, UserName = uName, Role = role }); //
                 }
 

+ 175 - 26
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -26,6 +26,7 @@ using OASystem.Domain.ViewModels.Groups;
 using OASystem.Infrastructure.Repositories.Financial;
 using OASystem.Infrastructure.Repositories.Groups;
 using Quartz.Util;
+using SqlSugar;
 using SqlSugar.Extensions;
 using System.Collections;
 using System.Data;
@@ -651,18 +652,21 @@ namespace OASystem.API.Controllers
                                                  .WhereIF(visitDt != null, x=> x.CreateTime == visitDt)
                                                  .FirstAsync();
 
-                    ffrInfo.Diid = diId;
-                    ffrInfo.PriceName = dto.ClientUnit;
-                    ffrInfo.Price = dto.PaymentMoney;
-                    ffrInfo.Count = 1;
-                    ffrInfo.Unit = $"元";
-                    ffrInfo.ItemSumPrice = dto.PaymentMoney;
-                    ffrInfo.Rate = 1.0000M;
-                    ffrInfo.Currency = 836;
-                    ffrInfo.AddingWay = 0;
-                    ffrInfo.CreateUserId = dto.UserId;
-                    ffrInfo.CreateTime = Convert.ToDateTime(dto.VisitDate).AddDays(-dto.PayDay);
-                    ffrInfo.Remark = $"预付款";
+                    ffrInfo = new Fin_ForeignReceivables()
+                    {
+                        Diid = diId,
+                        PriceName = dto.ClientUnit,
+                        Price = dto.PaymentMoney,
+                        Count = 1,
+                        Unit = $"元",
+                        ItemSumPrice = dto.PaymentMoney,
+                        Rate = 1.0000M,
+                        Currency = 836,
+                        AddingWay = 0,
+                        CreateUserId = dto.UserId,
+                        CreateTime = Convert.ToDateTime(dto.VisitDate).AddDays(-dto.PayDay),
+                        Remark = $"预付款"
+                    };
 
                     if (ffrInfo == null) //Add
                     {
@@ -670,7 +674,7 @@ namespace OASystem.API.Controllers
                     }
                     else //修改
                     {
-                        await _sqlSugar.Updateable<Fin_ForeignReceivables>(ffrInfo)
+                        await _sqlSugar.Updateable(ffrInfo)
                                        .UpdateColumns(x => new
                                        {
                                            x.PriceName,
@@ -809,18 +813,21 @@ namespace OASystem.API.Controllers
                                                  .WhereIF(visitDt != null, x => x.CreateTime == visitDt)
                                                  .FirstAsync();
 
-                    ffrInfo.Diid = diId;
-                    ffrInfo.PriceName = dto.ClientUnit;
-                    ffrInfo.Price = dto.PaymentMoney;
-                    ffrInfo.Count = 1;
-                    ffrInfo.Unit = $"元";
-                    ffrInfo.ItemSumPrice = dto.PaymentMoney;
-                    ffrInfo.Rate = 1.0000M;
-                    ffrInfo.Currency = 836;
-                    ffrInfo.AddingWay = 0;
-                    ffrInfo.CreateUserId = dto.UserId;
-                    ffrInfo.CreateTime = Convert.ToDateTime(dto.VisitDate).AddDays(-dto.PayDay);
-                    ffrInfo.Remark = $"预付款";
+                    ffrInfo = new Fin_ForeignReceivables()
+                    {
+                        Diid = diId,
+                        PriceName = dto.ClientUnit,
+                        Price = dto.PaymentMoney,
+                        Count = 1,
+                        Unit = $"元",
+                        ItemSumPrice = dto.PaymentMoney,
+                        Rate = 1.0000M,
+                        Currency = 836,
+                        AddingWay = 0,
+                        CreateUserId = dto.UserId,
+                        CreateTime = Convert.ToDateTime(dto.VisitDate).AddDays(-dto.PayDay),
+                        Remark = $"预付款"
+                    };
 
                     if (ffrInfo == null) //Add
                     {
@@ -1002,6 +1009,140 @@ namespace OASystem.API.Controllers
                 throw;
             }
         }
+
+        /// <summary>
+        /// 团组清单 Excel
+        /// </summary>
+        /// <param name="beginDt">开始时间 EG:“2024-01-01”</param>
+        /// <param name="endDt">结束时间 EG;“2024-12-31”</param>
+        /// <returns></returns>
+        [HttpGet]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GroupListFile([FromQuery]string beginDt, [FromQuery] string endDt)
+        {
+            DateTime _beginDt, _endDt;
+            bool beginBool = DateTime.TryParse($"{beginDt} 00:00:00", out _beginDt),
+                 endBool = DateTime.TryParse($"{endDt} 23:59:59", out _endDt);
+            if (!beginBool && !endBool)
+            {
+                return Ok(JsonView(false, "开始或结束时间不正确!"));
+            }
+
+            string sql = string.Format(@"
+SELECT
+  ROW_NUMBER,
+  Id,
+  SalesQuoteNo,
+  TourCode,
+  TeamTypeId,
+  TeamType,
+  TeamLevId,
+  TeamLev,
+  TeamName,
+  ClientName,
+  ClientUnit,
+  VisitDate,
+  VisitDays,
+  VisitPNumber,
+  JietuanOperatorId,
+  JietuanOperator,
+  IsSure,
+  CreateTime,
+  IsBid
+FROM
+  (
+    SELECT
+      ROW_NUMBER() OVER(
+        ORDER BY
+          gdi.CreateTime Desc
+      ) AS ROW_NUMBER,
+      gdi.Id,
+      SalesQuoteNo,
+      TourCode,
+      ssd.Id TeamTypeId,
+      ssd.Name TeamType,
+      ssd1.Id TeamLevId,
+      ssd1.Name TeamLev,
+      TeamName,
+      ClientName,
+      ClientUnit,
+      VisitDate,
+      VisitDays,
+      VisitPNumber,
+      JietuanOperator JietuanOperatorId,
+      su.CnName JietuanOperator,
+      IsSure,
+      gdi.CreateTime,
+      gdi.IsBid
+    FROM
+      Grp_DelegationInfo gdi
+      LEFT JOIN Sys_SetData ssd ON gdi.TeamDid = ssd.Id
+      LEFT JOIN Sys_SetData ssd1 ON gdi.TeamLevSId = ssd1.Id
+      LEFT JOIN Sys_Users su ON gdi.JietuanOperator = su.Id
+    WHERE
+      gdi.IsDel = 0
+      AND gdi.IsBid = 0
+      AND gdi.CreateTime BETWEEN '{0}' AND '{1}'
+  ) temp", _beginDt.ToString("yyyy-MM-dd HH:mm:ss"), _endDt.ToString("yyyy-MM-dd HH:mm:ss"));
+
+
+            var groupList = await _sqlSugar.SqlQueryable<DelegationListView>(sql).ToListAsync();
+
+            #region 处理所属部门
+            /*
+             * 1.sq 和 gyy 等显示 市场部
+             * 2.王鸽和主管及张总还有管理员号统一国交部
+             * 2-1.  4	管理员 ,21	张海麟
+             */
+            List<int> userIds = groupList.Select(it => it.JietuanOperatorId).ToList();
+            List<int> userIds1 = new List<int>() { 4, 21 };
+            var userDepDatas = await _sqlSugar.Queryable<Sys_Users>()
+                                              .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
+                                              .Where(u => u.IsDel == 0 && userIds.Contains(u.Id))
+                                              .Select((u, d) => new { UserId = u.Id, DepName = userIds1.Contains(u.Id) ? "国交部" : d.DepName })
+                                              .ToListAsync();
+
+            foreach (var item in groupList)
+            {
+                item.Department = userDepDatas.Find(it => item.JietuanOperatorId == it.UserId)?.DepName ?? "Unknown";
+            }
+            #endregion
+
+            #region Excel
+            var tempPath = AppSettingsHelper.Get("ExcelTempPath");
+            var servicePath = AppSettingsHelper.Get("GrpFileBaseUrl");
+            var savePath = AppSettingsHelper.Get("GrpListFileBasePath");
+            var ftpPath = AppSettingsHelper.Get("GrpListFileFtpPath");
+            var fileName = $"团组清单({beginDt}~{endDt}){DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx";
+
+
+            //载入模板
+            WorkbookDesigner designer = new WorkbookDesigner();
+            designer.Workbook = new Workbook($"{tempPath}团组清单模板.xlsx");
+
+            
+            designer.SetDataSource("Titel", $"团组清单({beginDt}~{endDt})");
+
+            DataTable dt = CommonFun.GetDataTableFromIList<DelegationListView>(groupList); ;
+            dt.TableName = "GroupList";
+            designer.SetDataSource(dt);
+            designer.Process();
+
+            if (!Directory.Exists(savePath))
+            {
+                Directory.CreateDirectory(savePath);
+            }
+
+            string serverPath = $"{savePath}{fileName}";
+            designer.Workbook.Save(serverPath);
+            string rst =$"{servicePath}{ftpPath}{fileName}";
+
+            #endregion
+
+            return Ok(JsonView(true, "操作成功!", rst));
+        }
+
+
         #endregion
 
         #region 团组&签证
@@ -10965,7 +11106,7 @@ ORDER by  gctggrc.id DESC
 
             var hrDtas = await _sqlSugar.Queryable<Grp_HotelReservations>()
                                         .Where(it => it.IsDel == 0 && it.DiId == _dto.DiId)
-                                        .OrderBy(x => x.CreateTime)
+                                        .OrderBy(x => x.CheckInDate)
                                         .ToListAsync();
 
             //判断数据是否完整
@@ -10992,6 +11133,14 @@ ORDER by  gctggrc.id DESC
                 }
                 else {
 
+
+                    bool guestIdBool = int.TryParse(item.GuestName,out int guestId);
+                    if (guestIdBool)
+                    {
+                        guestIds.Add(guestId);
+                    }
+
+
                     //NaN
                     if (item.GuestName.Contains("NaN"))
                     {

+ 53 - 21
OASystem/OASystem.Api/Controllers/PersonnelModuleController.cs

@@ -1,6 +1,7 @@
 using Aliyun.Credentials.Utils;
 using Aspose.Cells;
 using FluentValidation;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.IdentityModel.Tokens;
 using NPOI.POIFS.Crypt.Dsig;
@@ -10,6 +11,7 @@ using OASystem.API.OAMethodLib.Hub.Hubs;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI;
 using OASystem.API.OAMethodLib.QiYeWeChatAPI.AppNotice;
 using OASystem.API.OAMethodLib.Quartz.Business;
+using OASystem.API.OAMethodLib.SignalR.Hubs;
 using OASystem.Domain.Dtos.Groups;
 using OASystem.Domain.Dtos.PersonnelModule;
 using OASystem.Domain.Entities.Groups;
@@ -25,6 +27,7 @@ using System.Data;
 using System.Diagnostics;
 using System.Globalization;
 using System.IO;
+using static OASystem.API.OAMethodLib.JWTHelper;
 
 namespace OASystem.API.Controllers
 {
@@ -54,8 +57,17 @@ namespace OASystem.API.Controllers
         /// <param name="wageSheetRep"></param>
         /// <param name="usersRep"></param>
         /// <param name="mapper"></param>
-        public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService, WageSheetRepository wageSheetRep, UsersRepository usersRep, IMapper mapper,
-            TaskAllocationRepository taskAllocationRep, IHubContext<ChatHub, IChatClient> hubContext, GoodsRepository goodsRep)
+        /// <param name="taskAllocationRep"></param>
+        /// <param name="hubContext"></param>
+        /// <param name="goodsRep"></param>
+        public PersonnelModuleController(IQiYeWeChatApiService qiYeWeChatApiService,
+                                         WageSheetRepository wageSheetRep,
+                                         UsersRepository usersRep,
+                                         IMapper mapper,
+                                         TaskAllocationRepository taskAllocationRep,
+                                         IHubContext<ChatHub, IChatClient> hubContext,
+                                         GoodsRepository goodsRep
+            )
         {
             _mapper = mapper;
             _usersRep = usersRep;
@@ -73,6 +85,7 @@ namespace OASystem.API.Controllers
             this._taskAllocationRep = taskAllocationRep;
             _hubContext = hubContext;
             _goodsRep = goodsRep;
+
         }
 
         #region 工资表单
@@ -1809,7 +1822,7 @@ namespace OASystem.API.Controllers
         /// 物品 详情
         /// </summary>
         /// <returns></returns>
-        [HttpGet]
+        [HttpGet()]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GoodsInfo(int portType, int id)
         {
@@ -1828,6 +1841,9 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GoodsOP(GoodsOPDTO _dto)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             var validator = new GoodsOPDTOValidator();
             var validatorRes = await validator.ValidateAsync(_dto);
             if (!validatorRes.IsValid)
@@ -1837,7 +1853,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, sb.ToString()));
             }
 
-            return Ok(await _goodsRep.GoodsOP(_dto));
+            return Ok(await _goodsRep.GoodsOP(_dto, _currUserInfo.UserId));
         }
 
         /// <summary>
@@ -1847,12 +1863,14 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpDelete("{id}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GoodsDel(int id,[FromQuery] int currUserId)
+        public async Task<IActionResult> GoodsDel(int id)
         {
             if (id < 1) return Ok(JsonView(false, MsgTips.Id));
-            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
 
-            return Ok(await _goodsRep.GoodsDel(id,currUserId));
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
+            return Ok(await _goodsRep.GoodsDel(id, _currUserInfo.UserId));
         }
 
         /// <summary>
@@ -1875,14 +1893,14 @@ namespace OASystem.API.Controllers
         /// 入库 详情
         /// </summary>
         /// <returns></returns>
-        [HttpGet]
+        [HttpGet("{id}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GoodsStorageInfo(int portType, int id)
+        public async Task<IActionResult> GoodsStorageInfo([FromQuery] int portType, int id)
         {
             if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
             if (id < 1) return Ok(JsonView(false, MsgTips.Id));
 
-            return Ok(await _goodsRep.GoodsStorageInfo(portType,id));
+            return Ok(await _goodsRep.GoodsStorageInfo(portType, id));
         }
 
         /// <summary>
@@ -1894,6 +1912,9 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GoodsStorageOP(GoodsStorageOPDTO _dto)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             var vadalitor = new GoodsStorageOPDTOValidator();
             var vadalitorRes = await vadalitor.ValidateAsync(_dto);
             if (!vadalitorRes.IsValid)
@@ -1903,7 +1924,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, sb.ToString()));
             }
 
-            return Ok(await _goodsRep.GoodsStorageOP(_dto));
+            return Ok(await _goodsRep.GoodsStorageOP(_dto, _currUserInfo.UserId));
         }
 
         /// <summary>
@@ -1912,13 +1933,16 @@ namespace OASystem.API.Controllers
         /// </summary>
         /// <returns></returns>
         [HttpDelete("{id}")]
+        [Authorize]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GoodsStorageDel(int id, [FromQuery] int currUserId)
+        public async Task<IActionResult> GoodsStorageDel(int id)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             if (id < 1) return Ok(JsonView(false, MsgTips.Id));
-            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
 
-            return Ok(await _goodsRep.GoodsStorageDel(id,currUserId));
+            return Ok(await _goodsRep.GoodsStorageDel(id, _currUserInfo.UserId));
         }
 
         /// <summary>
@@ -1941,9 +1965,9 @@ namespace OASystem.API.Controllers
         /// 领用详情
         /// </summary>
         /// <returns></returns>
-        [HttpGet]
+        [HttpGet("{id}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GoodsReceiveInfo(int portType, int id)
+        public async Task<IActionResult> GoodsReceiveInfo([FromQuery]int portType, int id)
         {
             if (portType > 1 || portType > 3) return Ok(JsonView(false, MsgTips.Port));
             if (id < 1) return Ok(JsonView(false, MsgTips.Id));
@@ -1960,6 +1984,9 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GoodsReceiveOP(GoodsReceiveOPDTO _dto)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             var vadalitor = new GoodsReceiveOPDTOValidator();
             var vadalitorRes = await vadalitor.ValidateAsync(_dto);
             if (!vadalitorRes.IsValid)
@@ -1969,7 +1996,7 @@ namespace OASystem.API.Controllers
                 return Ok(JsonView(false, sb.ToString()));
             }
 
-            return Ok(await _goodsRep.GoodsReceiveOP(_dto));
+            return Ok(await _goodsRep.GoodsReceiveOP(_dto, _currUserInfo.UserId));
         }
 
         /// <summary>
@@ -1982,6 +2009,9 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> GoodsReceiveAudit(GoodsReceiveAuditDTO _dto)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             var vadalitor = new GoodsReceiveAuditDTOValidator();
             var vadalitorRes = await vadalitor.ValidateAsync(_dto);
             if (!vadalitorRes.IsValid)
@@ -1999,7 +2029,7 @@ namespace OASystem.API.Controllers
                                     else return id;
                                 })
                                 .ToArray();
-            return Ok(await _goodsRep.GoodsReceiveAudit(idArray,_dto.CurrUserId,_dto.AuditEnum));
+            return Ok(await _goodsRep.GoodsReceiveAudit(idArray, _currUserInfo.UserId, _dto.AuditEnum));
         }
         
         /// <summary>
@@ -2009,12 +2039,14 @@ namespace OASystem.API.Controllers
         /// <returns></returns>
         [HttpDelete("{id}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GoodsReceiveDel(int id, [FromQuery] int currUserId)
+        public async Task<IActionResult> GoodsReceiveDel(int id)
         {
+            var _currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (_currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
             if (id < 1) return Ok(JsonView(false, MsgTips.Id));
-            if (currUserId < 1) return Ok(JsonView(false, MsgTips.UserId));
 
-            return Ok(await _goodsRep.GoodsReceiveDel(id, currUserId));
+            return Ok(await _goodsRep.GoodsReceiveDel(id, _currUserInfo.UserId));
         }
         #endregion
     }

+ 7 - 14
OASystem/OASystem.Api/OAMethodLib/JwtHelper.cs

@@ -15,9 +15,8 @@ namespace OASystem.API.OAMethodLib
     {
         public class JwtHelper
         {
+            private readonly static IHttpContextAccessor _httpContext = AutofacIocManager.Instance.GetService<IHttpContextAccessor>();
 
-
-            private readonly static IHttpContextAccessor _httpContextAccessor = AutofacIocManager.Instance.GetService<IHttpContextAccessor>();
             /// <summary>
             /// 颁发JWT字符串
             /// </summary>
@@ -34,17 +33,16 @@ namespace OASystem.API.OAMethodLib
               {
                  /*
                  * 特别重要:
-                   1、这里将用户的部分信息,比如 uid 存到了Claim 中,如果你想知道如何在其他地方将这个 uid从 Token 中取出来,请看下边的SerializeJwt() 方法,或者在整个解决方案,搜索这个方法,看哪里使用了!
+                   1、这里将用户的部分信息,比如 uid 存到了Claim 中,如果你想知道如何在其他地方将这个 uid从 Token 中取出来,请看下边的SerializeJwt() 方法
                    2、你也可以研究下 HttpContext.User.Claims ,具体的你可以看看 Policys/PermissionHandler.cs 类中是如何使用的。
                  */                
 
                 new Claim(JwtRegisteredClaimNames.Jti, tokenModel.UserId.ToString()),
-                //new Claim(JwtRegisteredClaimNames.GivenName, tokenModel.UserName),
-                new Claim("UserName", tokenModel.UserName),
+                new Claim(JwtRegisteredClaimNames.Name, tokenModel.UserName),
                 //new Claim("UserId", tokenModel.UserId.ToString()),
                 new Claim(JwtRegisteredClaimNames.Iat, $"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}"),
                 new Claim(JwtRegisteredClaimNames.Nbf,$"{new DateTimeOffset(DateTime.Now).ToUnixTimeSeconds()}") ,
-                //这个就是过期时间,目前是过期7200秒,可自定义,注意JWT有自己的缓冲过期时间
+                //过期时间,目前是过期7200秒,可自定义,注意JWT有自己的缓冲过期时间
                 new Claim(JwtRegisteredClaimNames.Exp,$"{new DateTimeOffset(DateTime.Now.AddSeconds(7200)).ToUnixTimeSeconds()}"),
                 new Claim(JwtRegisteredClaimNames.Iss,iss),
                 new Claim(JwtRegisteredClaimNames.Aud,aud),
@@ -67,12 +65,6 @@ namespace OASystem.API.OAMethodLib
                     //,expires:DateTime.Now.AddMinutes(1)
                     );
 
-               // var indentity = new ClaimsIdentity(claims, "FMGJ-OASystem");
-               // var principal = new ClaimsPrincipal(indentity);
-
-               //await _httpContextAccessor.HttpContext?.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
-                
-
                 var jwtHandler = new JwtSecurityTokenHandler();
                 var encodedJwt = jwtHandler.WriteToken(jwt);
 
@@ -86,13 +78,14 @@ namespace OASystem.API.OAMethodLib
             /// <returns></returns>
             public static TokenModelJwt SerializeJwt(string jwtStr)
             {
+                if (string.IsNullOrEmpty(jwtStr)) return null;
                 var jwtHandler = new JwtSecurityTokenHandler();
-                JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr);
+                JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(jwtStr.Replace("Bearer ", ""));
                 object role,userName;
                 try
                 {
                     jwtToken.Payload.TryGetValue(ClaimTypes.Role, out role);
-                    jwtToken.Payload.TryGetValue("UserName", out userName);
+                    jwtToken.Payload.TryGetValue("name", out userName);
                 }
                 catch (Exception e)
                 {

+ 1 - 1
OASystem/OASystem.Api/OAMethodLib/Quartz/Jobs/ALiYunPostMessageJob.cs

@@ -16,7 +16,7 @@ namespace QuzrtzJob.Factory
             _logger.LogInformation("调用阿里云短信接口 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
             //在此处编写任务业务代码
             DeleReminderMessage.PostMessageByWebhook();
-
+            DeleReminderMessage.PostMessageByWebhook_CRMStatistics();
             return Task.CompletedTask;
         }
     }

+ 7 - 6
OASystem/OASystem.Api/Program.cs

@@ -29,8 +29,9 @@ using Microsoft.Extensions.Options;
 using Microsoft.AspNetCore.Identity;
 using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
 using OASystem.API.Middlewares;
+using Microsoft.Extensions.DependencyInjection;
 
-    var builder = WebApplication.CreateBuilder(args);
+var builder = WebApplication.CreateBuilder(args);
 var basePath = AppContext.BaseDirectory;
 
 //引入配置文件
@@ -73,11 +74,11 @@ builder.Services.AddCors(policy =>
     //.WithExposedHeaders("X-Pagination"));
 
     policy.AddPolicy("Cors", opt => opt
-          .SetIsOriginAllowed(origin => true)//这个必须加
-          //.AllowAnyOrigin()
+          .SetIsOriginAllowed(origin => true)
+                                             //.AllowAnyOrigin()
           .AllowAnyHeader()
           .WithMethods("GET", "POST", "HEAD", "PUT", "DELETE", "OPTIONS")
-          .AllowCredentials());//这个一定不能少);
+          .AllowCredentials());
 
 });
 #endregion
@@ -124,13 +125,13 @@ builder.Services.AddScoped(options =>
         new ConnectionConfig() {
             ConfigId = DBEnum.OA2023DB,
             ConnectionString = _config.GetConnectionString("OA2023DB"),
-            DbType = DbType.SqlServer, 
+            DbType = DbType.SqlServer,
             IsAutoCloseConnection = true },
         new ConnectionConfig()
         {
             ConfigId = DBEnum.OA2014DB,
             ConnectionString = _config.GetConnectionString("OA2014DB"),
-            DbType = DbType.SqlServer, 
+            DbType = DbType.SqlServer,
             IsAutoCloseConnection = true },
     });
 });

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

@@ -122,6 +122,10 @@
   "GrpFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/",
   "GrpFileFtpPath": "Office/GrpFile/",
 
+  "ExcelTempPath": "D:/FTP/File/OA2023/Office/Excel/Template/",
+  "GrpListFileBasePath": "D:/FTP/File/OA2023/Office/GrpFile/GroupList/",
+  "GrpListFileFtpPath": "Office/GrpFile/GroupList/",
+
   "VisaProgressImageBaseUrl": "http://132.232.92.186:24/",
   "VisaProgressImageBasePath": "D:/FTP/File/OA2023/Image/Visa/",
   "VisaProgressImageFtpPath": "Image/Visa/",
@@ -354,7 +358,7 @@
       ]
     }
   ],
-  
+
   //日付类型Data
   "Dailypayment": "666,667"
 }

+ 2 - 21
OASystem/OASystem.Domain/Dtos/PersonnelModule/GoodsDTO.cs

@@ -36,11 +36,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
     /// </summary>
     public class GoodsOPDTO
     {
-        /// <summary>
-        /// 当前用户id
-        /// </summary>
-        public int CurrUserId { get; set; }
-
         /// <summary>
         /// ID编号
         /// ID > 0 Edit
@@ -75,7 +70,7 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         /// </summary>
         public GoodsOPDTOValidator()
         {
-            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            //RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
             RuleFor(x => x.Name).NotEmpty().WithMessage("物品名称为空!");
             RuleFor(x => x.Type).Must(x => x > 0).WithMessage("物品所属类型未选择!");
         }
@@ -103,11 +98,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
     /// </summary>
     public class GoodsStorageOPDTO
     {
-        /// <summary>
-        /// 当前用户id
-        /// </summary>
-        public int CurrUserId { get; set; }
-
         /// <summary>
         /// ID编号
         /// ID > 0 Edit
@@ -173,7 +163,7 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         /// </summary>
         public GoodsStorageOPDTOValidator()
         {
-            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
+            //RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
             RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
             RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
             RuleFor(x => x.UnitPrice).Must(x => x > 0).WithMessage("请传入有效的物品单价!");
@@ -208,8 +198,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
     /// </summary>
     public class GoodsReceiveOPDTO
     {
-        public int CurrUserId { get; set; }
-
         /// <summary>
         /// ID
         /// Id > 0 修改
@@ -256,7 +244,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         /// </summary>
         public GoodsReceiveOPDTOValidator()
         {
-            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
             RuleFor(x => x.GoodsId).Must(x => x > 0).WithMessage("请传入有效的物品Id!");
             RuleFor(x => x.Quantity).Must(x => x > 0).WithMessage("请传入有效的物品数量!");
             RuleFor(x => x.Reason).NotEmpty().WithMessage("请填写领用原由!");
@@ -274,11 +261,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         /// </summary>
         public string Label { get; set; }
 
-        /// <summary>
-        /// 用户Id
-        /// </summary>
-        public int CurrUserId { get; set; }
-
         /// <summary>
         /// 审核状态
         /// </summary>
@@ -296,7 +278,6 @@ namespace OASystem.Domain.Dtos.PersonnelModule
         /// </summary>
         public GoodsReceiveAuditDTOValidator()
         {
-            RuleFor(x => x.CurrUserId).Must(x => x > 0).WithMessage("请传入当前登陆用户ID!");
             RuleFor(x => x.Label).NotEmpty().WithMessage("数据ID字符串为空!");
         }
     }

+ 9 - 0
OASystem/OASystem.Domain/ViewModels/Groups/DelegationInfoView.cs

@@ -456,6 +456,13 @@ namespace OASystem.Domain.ViewModels.Groups
         /// </summary>
         public DateTime VisitDate { get; set; }
 
+        public string VisitDateStr
+        {
+            get
+            {
+                return VisitDate.ToString("yyyy-MM-dd");
+            }
+        }
         /// <summary>
         /// 出行天数
         /// </summary>
@@ -482,6 +489,8 @@ namespace OASystem.Domain.ViewModels.Groups
         /// 流程管控Id
         /// </summary>
         public int GrpScheduleId { get; set; } = 0;
+
+        public DateTime CreateTime { get; set; }
     }
 
     

+ 16 - 12
OASystem/OASystem.Infrastructure/Repositories/PersonnelModule/GoodsRepository.cs

@@ -132,6 +132,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                                       {
                                           gi.Id,
                                           gi.Name,
+                                          ParentType = sd.STid,
                                           gi.Type,
                                           TypeName = sd.Name,
                                           gi.SQ_Total,
@@ -156,8 +157,9 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
         /// 物品 OP(Create Or Edit)
         /// </summary>
         /// <param name="_dto"></param>
+        /// <param name="currUserId"></param>
         /// <returns></returns>
-        public async Task<JsonView> GoodsOP(GoodsOPDTO _dto)
+        public async Task<JsonView> GoodsOP(GoodsOPDTO _dto,int currUserId)
         {
             var info = new Pm_GoodsInfo()
             {
@@ -169,9 +171,9 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                 PriceTotal = 0,
                 StockQuantity = 0,
                 Remark = _dto.Remark,
-                LastUpdateUserId = _dto.CurrUserId,
+                LastUpdateUserId = currUserId,
                 LastUpdateTime = DateTime.Now,
-                CreateUserId = _dto.CurrUserId
+                CreateUserId = currUserId
             };
 
             if (_dto.Id > 0) //Edit
@@ -314,7 +316,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                                       .LeftJoin<Pm_GoodsInfo>((gs, gi) => gs.GoodsId == gi.Id)
                                       .LeftJoin<Sys_Users>((gs, gi, u) => gs.CreateUserId == u.Id)
                                       .Where((gs, gi, u) => gs.IsDel == 0)
-                                      .WhereIF(id > 0, (gs, gi, u) => gs.GoodsId == id)
+                                      .WhereIF(id > 0, (gs, gi, u) => gs.Id == id)
                                       .Select((gs, gi, u) => new
                                       {
                                           gs.Id,
@@ -342,12 +344,13 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
         /// <summary>
         /// 物品入库 操作(Create Or Edit)
         /// </summary>
-        /// <param name="id"></param>
+        /// <param name="_dto"></param>
+        /// <param name="currUserId"></param>
         /// <returns></returns>
-        public async Task<JsonView> GoodsStorageOP(GoodsStorageOPDTO _dto)
+        public async Task<JsonView> GoodsStorageOP(GoodsStorageOPDTO _dto,int currUserId)
         {
             var info = _mapper.Map<Pm_GoodsStorage>(_dto);
-            info.CreateUserId = _dto.CurrUserId;
+            info.CreateUserId = currUserId;
 
             decimal editAgoQauntity = 0.00M,
                     editAgoTotalPrice = 0.00M;
@@ -396,7 +399,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
             goodsInfo.SQ_Total = goodsInfo.SQ_Total - editAgoQauntity + info.Quantity;
             goodsInfo.StockQuantity = goodsInfo.StockQuantity - editAgoQauntity + info.Quantity;
             goodsInfo.PriceTotal = goodsInfo.PriceTotal - editAgoTotalPrice + info.TotalPrice;
-            goodsInfo.LastUpdateUserId = _dto.CurrUserId;
+            goodsInfo.LastUpdateUserId = currUserId;
             goodsInfo.LastUpdateTime = DateTime.Now;
 
             var goodsEdit = await _sqlSugar.Updateable(goodsInfo)
@@ -544,7 +547,7 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
                                       .LeftJoin<Sys_Users>((gr, gi, u1) => gr.AuditUserId == u1.Id)
                                       .LeftJoin<Sys_Users>((gr, gi, u1, u2) => gr.CreateUserId == u2.Id)
                                       .Where((gr, gi, u1, u2) => gr.IsDel == 0)
-                                      .WhereIF(id > 0, (gr, gi, u1, u2u) => gr.GoodsId == id)
+                                      .WhereIF(id > 0, (gr, gi, u1, u2u) => gr.Id == id)
                                       .Select((gr, gi, u1, u2) => new
                                       {
                                           gr.Id,
@@ -573,12 +576,13 @@ namespace OASystem.Infrastructure.Repositories.PersonnelModule
         /// <summary>
         /// 物品领用 OP(Add Or Edit)
         /// </summary>
-        /// <param name="id"></param>
+        /// <param name="_dto"></param>
+        /// <param name="currUserId"></param>
         /// <returns></returns>
-        public async Task<JsonView> GoodsReceiveOP(GoodsReceiveOPDTO _dto)
+        public async Task<JsonView> GoodsReceiveOP(GoodsReceiveOPDTO _dto,int currUserId)
         {
             var info = _mapper.Map<Pm_GoodsReceive>(_dto);
-            info.CreateUserId = _dto.CurrUserId;
+            info.CreateUserId = currUserId;
             _sqlSugar.BeginTran();
 
             //物品现有库存