Bläddra i källkod

日付新需求 -->部门经理这个下拉框放开 可以查看本部门门员工申请的情况

LEIYI 11 månader sedan
förälder
incheckning
e9da8eecbd

+ 6 - 1
OASystem/OASystem.Api/Controllers/FinancialController.cs

@@ -28,6 +28,7 @@ using System.IO.Compression;
 using NPOI.SS.Formula.Functions;
 using Org.BouncyCastle.Asn1.X509.Qualified;
 using MathNet.Numerics;
+using static OASystem.API.OAMethodLib.JWTHelper;
 
 namespace OASystem.API.Controllers
 {
@@ -86,7 +87,11 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> PostPageSearchDailyPaymentPriceTypeData(PortDtoBase dto)
         {
-            var result = await _daiRep.GetPagePriceTypeData(dto);
+            var currUserInfo = JwtHelper.SerializeJwt(HttpContext.Request.Headers.Authorization);
+            if (currUserInfo == null) return Ok(JsonView(false, "请传入token!"));
+
+
+            var result = await _daiRep.GetPagePriceTypeData(dto,currUserInfo.UserId);
 
             if (result == null || result.Code != 0)
             {

+ 44 - 5
OASystem/OASystem.Infrastructure/Repositories/Financial/DailyFeePaymentRepository.cs

@@ -41,7 +41,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
         /// </summary>
         /// <param name="dto"></param>
         /// <returns></returns>
-        public async Task<Result> GetPagePriceTypeData(PortDtoBase dto)
+        public async Task<Result> GetPagePriceTypeData(PortDtoBase dto, int currUserId = 0)
         {
             Result result = new Result() { Code = -2 };
 
@@ -53,8 +53,47 @@ namespace OASystem.Infrastructure.Repositories.Financial
             //48人员费用  49办公费用 50 销售费用 51 其他费用 55 大运会
             var priceTypeData = setTypeData.Where(s => s.Id == 48 || s.Id == 49 || s.Id == 50 || s.Id == 51 || s.Id == 55).ToList();
             var priceSubTypeData = setData.Where(s => s.STid == 48 || s.STid == 49 || s.STid == 50 || s.STid == 51 || s.STid == 55).ToList();
+
+            var isEnable = false; 
             //员工姓名列表
-            var userNameData = await _UsersRep.GetUserNameList(dto.PortType);
+            var userData = _sqlSugar.Queryable<Sys_Users>()
+                    .Where(x => x.IsDel == 0)
+                    .Select(x => new { x.Id, x.DepId, x.CnName })
+                    .ToList();
+            //1 经理职位 查看该部门下所有人员
+            if (currUserId > 0)
+            {
+                //42
+                var auditUserIds = _sqlSugar.Queryable<Sys_UserAuthority>().Where(x => x.IsDel == 0 && x.SmId == 42 && x.FId == 12).Select(x => x.UId).ToList();
+                if (!auditUserIds.Contains(currUserId))
+                {
+                    var screenWheres = new List<string>() { "经理", "主管" };
+                    var userInfo = _sqlSugar.Queryable<Sys_Users>()
+                         .LeftJoin<Sys_Department>((u, d) => u.DepId == d.Id)
+                         .LeftJoin<Sys_JobPost>((u, d, jp) => u.JobPostId == jp.Id)
+                         .Where((u, d, jp) => u.IsDel == 0 && u.Id == currUserId && screenWheres.Contains(jp.JobName))
+                         .Select((u, d, jp) => new
+                         {
+                             u.Id,
+                             u.CnName,
+                             u.DepId,
+                             d.DepName,
+                             u.JobPostId,
+                             jp.JobName
+                         })
+                         .First();
+                    if (userInfo != null)
+                    {
+                        userData = userData.Where(x => x.DepId == userInfo.DepId).ToList();
+                    }
+                    else
+                    {
+                        userData = userData.Where(x => x.Id == currUserId).ToList();
+                    }
+                }
+                
+            }
+            var userData1 = userData.Select(x => new { x.Id, x.CnName }).ToList();
             //62 公转 63 私转
             var feeMarkTypeData = setTypeData.Where(s => s.Id == 62 || s.Id == 63).ToList();
             var feeMarkSubTypeData = setData.Where(s => s.STid == 62 || s.STid == 63).ToList();
@@ -62,11 +101,11 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
             if (dto.PortType == 1) //web
             {
-                DailyFeePaymentList = new Fin_DailyFeePaymentPagePriceTypeDataView
+                DailyFeePaymentList = new 
                 {
                     FeeTypeData = priceTypeData,
                     FeeSubTypeData = priceSubTypeData,
-                    UserNameData = userNameData.Data,
+                    UserNameData = userData1,
                     FeeMarkTypeData = feeMarkTypeData,
                     FeeMarkSubTypeData = feeMarkSubTypeData,
                     CompanyNameData = companyNameData.Data
@@ -77,7 +116,7 @@ namespace OASystem.Infrastructure.Repositories.Financial
 
                 DailyFeePaymentList = new
                 {
-                    UserNameData = userNameData.Data,
+                    UserNameData = userData1,
                     FeeTypeData = priceTypeData,
                     FeeTypeSubData = priceSubTypeData
                 };