Parcourir la source

API添加权限管理
修改导入数据后的邮件通知格式

luocaiyang il y a 3 ans
Parent
commit
d49c474c3f

+ 9 - 2
wispro.sp.api/AppealHandler/MissingCaseReviewHandler.cs

@@ -66,15 +66,22 @@ namespace wispro.sp.api.AppealHandler
 
                 
                 PerformanceItem Item = itemControler.GetItemInfoByCaseStage(strCaseNo,strDoItem, strCaseStage);
+
+
                 var Rules = ((spDbContext)spContext).BasePointRules.ToList();
                 
                 Utility.Utility.CalBasePoint(Item, Rules);
 
                 CalMonth calMonth = ((spDbContext)spContext).CalMonths.FirstOrDefault(c=>c.Status == 0);
 
-                if (calMonth != null)
+
+                if (calMonth != null )
                 {
-                    SaveToDb(Item, (spDbContext)spContext, calMonth);
+                    if (Item.Id == 0 || Item.CalMonthId != calMonth.Id)
+                    {
+                        Item.Id = 0;
+                        SaveToDb(Item, (spDbContext)spContext, calMonth);
+                    }
                 }
                 //((spDbContext)spContext).PerformanceItems.Add(Item);
                 //((spDbContext)spContext).SaveChanges();

+ 5 - 7
wispro.sp.api/Controllers/AccountController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Configuration;
 using Microsoft.IdentityModel.Tokens;
 using System;
@@ -51,6 +52,7 @@ namespace wispro.sp.api.Controllers
             
         }
 
+        [Authorize]
         [HttpGet, HttpPost, Route("ChangePassword")]
         public bool ChangePassword(changePasswordDto dto)
         {
@@ -68,7 +70,7 @@ namespace wispro.sp.api.Controllers
             }
         }
 
-
+        [Authorize]
         [HttpGet,Route("GetUser")]
         public userToken GetUser()
         {
@@ -142,7 +144,7 @@ namespace wispro.sp.api.Controllers
 
         }
 
-
+        [Authorize]
         [HttpGet, HttpPost, Route("GetRoles")]
         public List<string> GetRoles(string ResourceId)
         {
@@ -154,10 +156,6 @@ namespace wispro.sp.api.Controllers
             }
 
             var ret = Authors.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
-            //if (ret.Length > 0)
-            //{
-            //    return new List<string> { "[35]-[2]" };
-            //}
 
             return ret.ToList<string>();
         }

+ 2 - 1
wispro.sp.api/Controllers/AppealController.cs

@@ -90,7 +90,8 @@ namespace wispro.sp.api.Controllers
 
                 Context.SaveChanges();
 
-                if (!string.IsNullOrEmpty(appealRecord.Type.ApplealObject))
+                var temType = Context.AppealTypes.FirstOrDefault(c=>c.Id == appealRecord.TypeId);
+                if (!string.IsNullOrEmpty(temType.ApplealObject))
                 {
                     IDoAppealObject doAppeal = (IDoAppealObject)Activator.CreateInstance(Type.GetType(appealRecord.Type.ApplealObject));
                     doAppeal.DoAppeal(appealObject, appealRecord.Id, Context);

+ 1 - 1
wispro.sp.api/Controllers/AttachFilesController.cs

@@ -17,7 +17,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
-    //[Authorize]
+    [Authorize]
     public class AttachFilesController : ControllerBase
     {
         private readonly IWebHostEnvironment env;

+ 3 - 1
wispro.sp.api/Controllers/ConditinController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Concurrent;
@@ -16,6 +17,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]")]
     [ApiController]
+    [Authorize]
     public class ConditinController : ControllerBase
     {
         spDbContext Context;

+ 3 - 1
wispro.sp.api/Controllers/FileProcesTaskController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.StaticFiles;
 using System;
@@ -11,6 +12,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
+    [Authorize]
     public class FileProcesTaskController : ControllerBase
     {
         Services.IFileTaskService fileTaskService;

+ 5 - 1
wispro.sp.api/Controllers/IPEasyController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using System;
 using System.Collections.Generic;
@@ -12,6 +13,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
+    [Authorize]
     public class IPEasyController : ControllerBase
     {
         spDbContext Context;
@@ -136,6 +138,7 @@ namespace wispro.sp.api.Controllers
                 Item.FinishedDate = string.IsNullOrEmpty(retObj.FinishedDate) ? null : DateTime.Parse(retObj.FinishedDate);
                 //Item.FirstDraftDate = string.IsNullOrEmpty(retObj.FirstDraftDate) ? null : DateTime.Parse(retObj.FirstDraftDate);
                 Item.InternalDate = string.IsNullOrEmpty(retObj.InternalDate) ? null : DateTime.Parse(retObj.InternalDate);
+                Item.WordCount = string.IsNullOrEmpty(retObj.WordCount) ? null : int.Parse(retObj.WordCount);
 
                 if (!string.IsNullOrEmpty(retObj.DoPersons))
                 {
@@ -218,6 +221,7 @@ namespace wispro.sp.api.Controllers
                 Item.FinishedDate = string.IsNullOrEmpty(retObj.FinishedDate) ? null : DateTime.Parse(retObj.FinishedDate);
                 //Item.FirstDraftDate = string.IsNullOrEmpty(retObj.FirstDraftDate) ? null : DateTime.Parse(retObj.FirstDraftDate);
                 Item.InternalDate = string.IsNullOrEmpty(retObj.InternalDate) ? null : DateTime.Parse(retObj.InternalDate);
+                Item.WordCount = string.IsNullOrEmpty(retObj.WordCount) ? null : int.Parse(retObj.WordCount);
 
                 if (!string.IsNullOrEmpty(retObj.DoPersons))
                 {

+ 3 - 1
wispro.sp.api/Controllers/OrganizationController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using System;
@@ -11,6 +12,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
+    [Authorize]
     public class OrganizationController : ControllerBase
     {
         spDbContext Context;

+ 7 - 7
wispro.sp.api/Controllers/PerformanceItemController.cs

@@ -23,7 +23,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
-    //[Authorize]
+    [Authorize]
     public class PerformanceItemController : ControllerBase
     {
         spDbContext Context;
@@ -1013,8 +1013,8 @@ namespace wispro.sp.api.Controllers
                     .Include(pi => pi.Reviewer)
                     .Include(pi => pi.Customer)
                     .Include(pi => pi.CalMonth)
-                    .OrderConditions<PerformanceItem>(queryFilter.Sorts)
-                    .Pager<PerformanceItem>(1, queryFilter.PageSize, out totals);
+                    .OrderConditions<PerformanceItem>(queryFilter.Sorts);
+                    //.Pager<PerformanceItem>(1, queryFilter.PageSize, out totals);
             }
             else
             {
@@ -1023,14 +1023,14 @@ namespace wispro.sp.api.Controllers
                     .Include(pi => pi.Reviewer)
                     .Include(pi => pi.Customer)
                     .Include(pi => pi.CalMonth)
-                    .OrderConditions<PerformanceItem>(queryFilter.Sorts)
-                    .Pager<PerformanceItem>(queryFilter.PageIndex, queryFilter.PageSize, out totals);
+                    .OrderConditions<PerformanceItem>(queryFilter.Sorts);
+                    //.Pager<PerformanceItem>(queryFilter.PageIndex, queryFilter.PageSize, out totals);
             }
             ret.TotalCount = totals;
 
 
 
-            var retList = response.ToList<PerformanceItem>();
+            var retList = response.ToList<PerformanceItem>().Skip((queryFilter.PageIndex-1) *queryFilter.PageSize).Take(queryFilter.PageSize);
 
 
             #region 将某些属性设为null,避免循环取值造成返回json过大
@@ -1063,7 +1063,7 @@ namespace wispro.sp.api.Controllers
             }
             #endregion
 
-            ret.Results = retList;
+            ret.Results = retList.ToList();
 
             return ret;
         }

+ 3 - 1
wispro.sp.api/Controllers/ProjectController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.EntityFrameworkCore;
 using System;
@@ -13,6 +14,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
+    [Authorize]
     public class ProjectController : ControllerBase
     {
         spDbContext Context;

+ 2 - 77
wispro.sp.api/Controllers/StaffController.cs

@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore;
 
 namespace wispro.sp.api.Controllers
 {
-    //[Authorize]
+    [Authorize]
     [Route("api/[controller]/[action]")]
     [ApiController]
     public class StaffController : ControllerBase
@@ -198,82 +198,7 @@ namespace wispro.sp.api.Controllers
             return ret;
         }
 
-        public ApiSaveResponse Init()
-        {
-            using (var t = Context.Database.BeginTransaction())
-            {
-                try
-                {
-                    Position p = Context.Positions.FirstOrDefault<Position>(p=>p.Name == "普通成员");
-
-                    if (p == null)
-                    {
-                        p = new Position() { Name = "普通成员" };
-                        Context.Positions.Add(p);
-                        Context.SaveChanges();
-                    }
-
-                    foreach (var staff in Context.Staffs.ToList())
-                    {
-                        string[] temStrs = staff.Department.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
-
-                        Department dept = null;
-                        foreach (string depName in temStrs)
-                        {
-                            if (dept == null)
-                            {
-                                System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex("\\((.+?)\\)");
-                                System.Text.RegularExpressions.Match m = r.Match(depName);
-
-                                if (m.Success)
-                                {
-                                    var Name1 = depName.Substring(0, m.Index);
-                                    dept = Context.Departments.FirstOrDefault<Department>(d => d.Name == Name1.Trim());
-
-                                    var Name2 = m.Groups[1].Value;
-                                    dept = Context.Departments.FirstOrDefault<Department>(d => d.Name == Name2.Trim() && d.parentId == dept.Id);
-                                }
-                                else
-                                {
-                                    dept = Context.Departments.FirstOrDefault<Department>(d => d.Name == depName.Trim());
-                                }
-                                
-                            }
-                            else
-                            {
-                                dept = Context.Departments.FirstOrDefault<Department>(d => d.Name == depName.Trim() && d.parentId == dept.Id);
-                            }
-                        }
-
-                        if (dept != null)
-                        {
-                            DepartmentPosition dp = new DepartmentPosition();
-                            dp.StaffId = staff.Id;
-                            dp.PositionId = p.Id;
-                            dp.departmentId = dept.Id;
-
-                            Context.DepartmentPositions.Add(dp);
-
-                        }
-                        else
-                        {
-                            System.Diagnostics.Debug.WriteLine($"{staff.Name}\t{staff.Department}");
-                        }
-                    }
-                    Context.SaveChanges();
-
-                    t.Commit();
-                }
-                catch(Exception ex)
-                {
-                    t.Rollback();
-                }
-
-            }
-
-            return new ApiSaveResponse() { Success = true };
-        }
-
+        
         public ApiSaveResponse SaveUser(SaveUserObject saveUser)
         {
             ApiSaveResponse ret = new ApiSaveResponse();

+ 1 - 1
wispro.sp.api/Controllers/StaffGradeController.cs

@@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
 
 namespace wispro.sp.api.Controllers
 {
-    //[Authorize]
+    [Authorize]
     [Route("api/[controller]/[action]")]
     [ApiController]
     public class StaffGradeController : ControllerBase

+ 1 - 1
wispro.sp.api/Controllers/VerifyCoefficientController.cs

@@ -11,7 +11,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
 
 namespace wispro.sp.api.Controllers
 {
-    //[Authorize]
+    [Authorize]
     [Route("api/[controller]")]
     [ApiController]
     public class VerifyCoefficientController : ControllerBase

+ 3 - 1
wispro.sp.api/Controllers/WorkflowEngineController.cs

@@ -1,4 +1,5 @@
-using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.AspNetCore.StaticFiles;
 using Microsoft.EntityFrameworkCore;
@@ -18,6 +19,7 @@ namespace wispro.sp.api.Controllers
 {
     [Route("api/[controller]/[action]")]
     [ApiController]
+    [Authorize]
     public class WorkflowEngineController : ControllerBase
     {
         spDbContext Context;

Fichier diff supprimé car celui-ci est trop grand
+ 6 - 3
wispro.sp.api/Job/ImportReportJob.cs


+ 12 - 1
wispro.sp.api/Job/UpdateJXDataFromIPEasyJob.cs

@@ -137,7 +137,18 @@ namespace wispro.sp.api.Job
                             }
                         }
 
-                        
+                        if (keyValuePairs.ContainsKey("WordCount"))
+                        {
+                            if (!string.IsNullOrEmpty(retObj.WordCount))
+                            {
+                                var wordCount = int.Parse(retObj.WordCount);
+
+                                if (wordCount != Item.WordCount)
+                                    Item.WordCount = wordCount;
+                            }
+                        }
+
+
                         if (keyValuePairs.ContainsKey("Reviewer") && (Item.Reviewer ==null || Item.Reviewer.Name != retObj.Reviewer) && !string.IsNullOrEmpty(retObj.Reviewer))
                         {
                             string name = retObj.Reviewer;

+ 4 - 1
wispro.sp.api/Startup.cs

@@ -2,6 +2,8 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
 using Microsoft.AspNetCore.Builder;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Query;
+using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Hosting;
@@ -64,7 +66,8 @@ namespace wispro.sp.api
             });
 
             services.AddDbContext<spDbContext>(optionsAction =>
-                optionsAction.UseSqlServer(Configuration.GetConnectionString("DefaultConnect"))
+                  optionsAction.UseSqlServer(Configuration.GetConnectionString("DefaultConnect"))
+                  .ReplaceService<IQueryTranslationPostprocessorFactory, SqlServer2008QueryTranslationPostprocessorFactory>()
             );
 
             services.AddSingleton<ISchedulerFactory, StdSchedulerFactory>();

+ 5 - 2
wispro.sp.api/appsettings.json

@@ -41,8 +41,11 @@
   },
 
   "Authorize": {
-    "/Department": "[94]-[1]",
-    "/Workflow/Manage": "[94]-[1]"
+    "/Department": "[94]-[1],[128]-[7]",
+    "/Workflow/Manage": "[94]-[1]",
+    "/CaseManager": "[128]-[7]",
+    "/Project/ProjectSearch": "[128]-[7]"
+
   }
   
 }

+ 30 - 27
wispro.sp.api/spDbContext.cs

@@ -586,8 +586,8 @@ namespace wispro.sp.api
                     new StaffGrade() {Id=12, Grade = "D2级", Coefficient = 0.6},
                     new StaffGrade() {Id=13, Grade = "D1级", Coefficient = 0.5},
                     new StaffGrade() {Id=14, Grade = "A级", Coefficient = 1.1},
-                    new StaffGrade() {Id=15, Grade = "C级", Coefficient = 1.0},
-                    new StaffGrade() {Id=16, Grade = "D级", Coefficient = 0.9}
+                    new StaffGrade() {Id=15, Grade = "B级", Coefficient = 1.0},
+                    new StaffGrade() {Id=16, Grade = "C级", Coefficient = 0.9}
                 });
 
             modelBuilder.Entity<VerifyCoefficient>().HasData(
@@ -658,40 +658,40 @@ namespace wispro.sp.api
                 );
 
             #region 初始化绩效点数规则
-            List<BasePointRule> rules = new List<BasePointRule>();
-            DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("c:\\temp\\20211130-点数规则-lcy-v1.xlsx", true);
+            //List<BasePointRule> rules = new List<BasePointRule>();
+            //DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable("c:\\temp\\20211130-点数规则-lcy-v1.xlsx", true);
 
-            foreach (DataRow row in dt.Rows)
-            {
-                BasePointRule rule = new BasePointRule()
-                {
-                    Rule = row["规则"].ToString(),
-                    PointExpress = row["点数计算"].ToString(),
-                    Priority = int.Parse(row["优先级修订"].ToString()),
-                    Type = row["类型"].ToString()
+            //foreach (DataRow row in dt.Rows)
+            //{
+            //    BasePointRule rule = new BasePointRule()
+            //    {
+            //        Rule = row["规则"].ToString(),
+            //        PointExpress = row["点数计算"].ToString(),
+            //        Priority = int.Parse(row["优先级修订"].ToString()),
+            //        Type = row["类型"].ToString()
 
-                };
+            //    };
 
-                rules.Add(rule);
-            }
+            //    rules.Add(rule);
+            //}
 
-            for (int i = 0; i < rules.Count; i++)
-            {
-                rules[i].Id = i + 1;
-            }
+            //for (int i = 0; i < rules.Count; i++)
+            //{
+            //    rules[i].Id = i + 1;
+            //}
 
 
-            modelBuilder.Entity<BasePointRule>().HasData(rules);
+            //modelBuilder.Entity<BasePointRule>().HasData(rules);
             #endregion
 
             AppealType[] appealTypes = new AppealType[]
             {
-                new AppealType(){Id=1, Name ="绩效点数分配比率",CanDoExpress = "p.ItemStaffs.Count()>1"},
-                new AppealType(){Id=2,Name ="案件系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
-                new AppealType(){Id=3,Name ="处理事项系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer"},
-                new AppealType(){Id=4,Name ="案件缺漏申诉",CanDoExpress ="",ReviewerExpress ="p.Reviewer",Type =1},
-                new AppealType(){Id=5,Name ="案件严重超期说明",CanDoExpress ="p.isDanger()"},
-                new AppealType(){Id=6,Name ="按照翻译字数算绩效备注",CanDoExpress ="p.DoItem==\"新申请\" || p.DoItem==\"翻译\""}
+                new AppealType(){Id=1, Name ="绩效点数分配比率",CanDoExpress = "p.ItemStaffs.Count()>1",NeedReview=true},
+                new AppealType(){Id=2,Name ="案件系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer",NeedReview =true },
+                new AppealType(){Id=3,Name ="处理事项系数复核",CanDoExpress = "p.DoItem==\"新申请\"",ReviewerExpress ="p.Reviewer", NeedReview = true},
+                new AppealType(){Id=4,Name ="案件缺漏申诉",CanDoExpress ="",ReviewerExpress ="p.Reviewer",Type =1, NeedReview = true},
+                new AppealType(){Id=5,Name ="案件严重超期说明",CanDoExpress ="p.isDanger()", NeedReview = true},
+                new AppealType(){Id=6,Name ="按照翻译字数算绩效备注",CanDoExpress ="p.DoItem==\"新申请\" || p.DoItem==\"翻译\"", NeedReview = true}
             };
 
             InputField[] inputFields = new InputField[] {
@@ -725,7 +725,7 @@ namespace wispro.sp.api
 
                 new InputField(){Id=19,AppealTypeId =6,AppealState =0,FieldName ="翻译类型", MapObjectField ="AgentFeedbackMemo", FieldType = typeof(string).ToString() },
                 new InputField(){Id=20,AppealTypeId =6,AppealState =0,FieldName ="翻译字数", MapObjectField ="WordCount", FieldType = typeof(int).ToString() },
-                new InputField(){Id=23,AppealTypeId =6,AppealState =1,FieldName ="审核意见",  FieldType = typeof(int).ToString() },
+                new InputField(){Id=23,AppealTypeId =6,AppealState =1,FieldName ="审核意见",  FieldType = typeof(string).ToString() },
                 new InputField(){Id=24,AppealTypeId =6,AppealState =1,FieldName ="翻译字数", MapObjectField ="WordCount", FieldType = typeof(int).ToString() },
 
             };
@@ -755,6 +755,9 @@ namespace wispro.sp.api
 
                 new SelectValue(){Id =19, InputFieldId =21, Value ="同意" },
                 new SelectValue(){Id =20, InputFieldId =21, Value ="拒绝" },
+
+                new SelectValue(){Id =21, InputFieldId =23, Value ="同意" },
+                new SelectValue(){Id =22, InputFieldId =23, Value ="拒绝" },
             };
 
             List<CaseCeoffcient> caseCeoffcients = new List<CaseCeoffcient>()

+ 1 - 0
wispro.sp.api/wispro.sp.api.csproj

@@ -7,6 +7,7 @@
 
   <ItemGroup>
     <PackageReference Include="DynamicExpresso.Core" Version="2.9.3" />
+    <PackageReference Include="EfCore.SqlServer2008Query" Version="1.0.4" />
     <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.18" />
     <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.10" />
     <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">

+ 0 - 12
wispro.sp.share/EFCoreExt.cs

@@ -283,18 +283,6 @@ namespace wispro.sp.share
         {
             foreach (var orderinfo in orderConditions)
             {
-                //var t = typeof(T);
-
-                //var propertyInfo = t.GetProperty(orderinfo.FieldName);
-                //var parameter = Expression.Parameter(t);
-                //Expression propertySelector = Expression.Property(parameter, propertyInfo);
-
-                //var orderby = Expression.Lambda<Func<T, dynamic>>(propertySelector, parameter);
-                //if (orderinfo.Sort == 1)
-                //    query = query.OrderByDescending(orderby);
-                //else
-                //    query = query.OrderBy(orderby);
-
                 var parameter = Expression.Parameter(typeof(T));
                 var prop = Expression.PropertyOrField(parameter, orderinfo.FieldName);
                 var sortLambda = Expression.Lambda(prop, parameter);

+ 7 - 4
wispro.sp.utility/IPEasyUtility.cs

@@ -401,6 +401,7 @@ namespace wispro.sp.utility
                         retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text;   //处理事项完成日
                         retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text;   //处理人
                         retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text;   //处理事项备注
+                        
 
                         DoItemLink.Click();
                     }
@@ -408,10 +409,12 @@ namespace wispro.sp.utility
                 
                 System.Threading.Thread.Sleep(500);
 
-                retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__finish_doc_date")).GetAttribute("value"); //定稿日
-                retObject.ReturnDate = driver.FindElement(By.Id("p_proc_info__back_date")).GetAttribute("value"); //返稿日
-                retObject.Reviewer = driver.FindElement(By.Id("p_proc_info__revise_user")).GetAttribute("value");      //核稿人
-                retObject.DoItemCoefficient = driver.FindElement(By.Id("p_proc_info__proc_coefficient")).GetAttribute("value");     //处理事项系数
+                retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__finish_doc_date")).GetAttribute("value");   //定稿日
+                retObject.ReturnDate = driver.FindElement(By.Id("p_proc_info__back_date")).GetAttribute("value");               //返稿日
+                retObject.Reviewer = driver.FindElement(By.Id("p_proc_info__revise_user")).GetAttribute("value");               //核稿人
+                retObject.DoItemCoefficient = driver.FindElement(By.Id("p_proc_info__proc_coefficient")).GetAttribute("value"); //处理事项系数
+                retObject.WordCount = driver.FindElement(By.Id("p_proc_info__translate_count")).GetAttribute("value");          //翻译字数
+
 
                 driver.FindElement(By.Id("libase")).Click();
                 System.Threading.Thread.Sleep(500);

+ 4 - 4
wispro.sp.utility/NPOIExcle.cs

@@ -85,10 +85,10 @@ namespace wispro.sp.utility
                                 for (int i = startRow; i <= rowCount; ++i)
                                 {
                                     row = sheet.GetRow(i);
-                                    if(row.GetCell(1).ToString()== "PACN2110126")
-                                    {
-                                        System.Diagnostics.Debug.WriteLine("");
-                                    }
+                                    //if(row.GetCell(1).ToString()== "PACN2110126")
+                                    //{
+                                    //    System.Diagnostics.Debug.WriteLine("");
+                                    //}
                                     if (row != null && IgnoreZeroHightRow && row.ZeroHeight)
                                     {
                                         System.Diagnostics.Debug.WriteLine (string.Format("[{0}]隐藏行:{1}", filePath, i));

+ 25 - 0
wispro.sp.web/Pages/Project/ProjectSearch.razor.cs

@@ -1,6 +1,7 @@
 using AntDesign;
 using AntDesign.TableModels;
 using Microsoft.AspNetCore.Components;
+using Microsoft.JSInterop;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -23,8 +24,32 @@ namespace wispro.sp.web.Pages.Project
         [Inject] protected IProjectService _itemService { get; set; }
         [Inject] public MessageService MsgSvr { get; set; }
 
+        [Inject] protected NavigationManager navigation { get; set; }
+
+        [Inject] protected IAuthService _authService { get; set; }
+
+        [Inject] protected IJSRuntime JSRuntime { get; set; }
+
         protected async override Task OnInitializedAsync()
         {
+            string strResourceId = navigation.Uri.Replace(navigation.BaseUri,"/");
+            Console.WriteLine(navigation.ToAbsoluteUri(navigation.Uri));
+            Console.WriteLine(navigation.ToBaseRelativePath(navigation.Uri));
+
+            var canVisist = await _authService.CanVisitResource(strResourceId);
+
+            if (!canVisist)
+            {
+                var config = new MessageConfig()
+                {
+                    Content = "您没有权限使用该功能",
+                    Type = MessageType.Error
+                };
+
+                var ret = MsgSvr.Open(config);
+                await JSRuntime.InvokeVoidAsync("history.back");
+            }
+
             ProjectInfos = await _itemService.GetAllProjects();
             _total = ProjectInfos.Count;
             await base.OnInitializedAsync();

+ 0 - 2
wispro.sp.web/Pages/Workflow/WorkflowDefine.razor.cs

@@ -44,8 +44,6 @@ namespace wispro.sp.web.Pages.Workflow
 
         [Inject] protected IAuthService _authService { get; set; }
 
-        [Inject] protected NavigationManager NavigationManager { get; set; }
-
         [Inject] protected IJSRuntime JSRuntime { get; set; }
 
 

+ 1 - 3
wispro.sp.web/Services/AuthService.cs

@@ -37,7 +37,7 @@ namespace wispro.sp.web.Services
             bool result = false;
 
             var httpResponse = await httpClient.Post<userToken>($"account/Login", userInfo);
-
+            Console.WriteLine(System.Text.Json.JsonSerializer.Serialize(httpResponse));
             if (httpResponse.StatusCode != System.Net.HttpStatusCode.NotFound)
             {
                 userToken userToken = httpResponse;
@@ -96,8 +96,6 @@ namespace wispro.sp.web.Services
 
                 
             }
-            
-            
 
             return canVisist;
 

+ 21 - 12
wispro.sp.winClient/Form1.cs

@@ -181,6 +181,7 @@ namespace wispro.sp.winClient
             woman
         }
 
+       
         private async void button3_Click(object sender, EventArgs e)
         {
             //share.Utility.UserConditionHelper.GetPropertyDescription<Staff>(typeof(PerformanceItem).AssemblyQualifiedName);
@@ -245,8 +246,8 @@ namespace wispro.sp.winClient
             //wispro.sp.utility.MailUtil.SendEmail("测试邮件标题","测试邮件内容","罗才洋","luocaiyang@139.com");
             //CreateAppealModel model = new CreateAppealModel();
             //HttpClient http = new HttpClient();
-            //PerformanceItem item = await http.GetFromJsonAsync<wispro.sp.entity.PerformanceItem>($"http://localhost:39476/api/PerformanceItem/Get?Id=7341");
-            //List<AppealType> appealTypes = await http.GetFromJsonAsync<List<AppealType>>($"http://localhost:39476/api/Appeal/GetAppealTypes");
+            //PerformanceItem item = await http.GetFromJsonAsync<wispro.sp.entity.PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/Get?Id=7341");
+            //List<AppealType> appealTypes = await http.GetFromJsonAsync<List<AppealType>>($"{strAPIBaseUri}/api/Appeal/GetAppealTypes");
             //var appealType = appealTypes.Where<AppealType>(a => a.Id == 1).FirstOrDefault();
             //await model.Init(item, appealType);
             ////await TestQueryFilter();
@@ -402,6 +403,12 @@ namespace wispro.sp.winClient
                     string[] temYFs = strjxyf.Split(new char[] { '.' });
                     item.CalMonth = new CalMonth();
                     item.CalMonth.Year = int.Parse(temYFs[0]);
+
+                    if (temYFs[1] == "1")
+                    {
+                        temYFs[1] = "10";
+                    }
+
                     item.CalMonth.Month = int.Parse(temYFs[1]);
                     item.CalMonth.Status = 4;
                 }
@@ -599,6 +606,7 @@ namespace wispro.sp.winClient
 
                 if (item != null )
                 {
+                    System.Diagnostics.Debug.WriteLine($"{DateTime.Now}\t{item.CaseNo}\t{item.CaseName}");
                     if (!InValidDoItem.Contains(item.DoItem))
                     {
                         await SavePerformanceItem(item);
@@ -688,9 +696,10 @@ namespace wispro.sp.winClient
             return retStr;
         }
 
+        string strAPIBaseUri = "http://47.106.221.167:8081";
         public async Task<entity.workflowDefine.Workflow> GetWorkflow(int Id, HttpClient _httpClient)
         {
-            var ret = await _httpClient.GetFromJsonAsync<entity.workflowDefine.Workflow>($"http://localhost:39476/api/WorkflowEngine/GetWorkflow?workflowId={Id}");
+            var ret = await _httpClient.GetFromJsonAsync<entity.workflowDefine.Workflow>($"{strAPIBaseUri}/api/WorkflowEngine/GetWorkflow?workflowId={Id}");
 
             
             return ret;
@@ -698,25 +707,25 @@ namespace wispro.sp.winClient
 
         public async Task<List<entity.workflowDefine.Step>> GetSteps(int Id, HttpClient _httpClient)
         {
-            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Step>>($"http://localhost:39476/api/WorkflowEngine/GetSteps?workflowId={Id}");
+            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Step>>($"{strAPIBaseUri}/api/WorkflowEngine/GetSteps?workflowId={Id}");
             return ret;
         }
 
         public async Task<List<entity.workflowDefine.Action>> GetActions(int workflowId, HttpClient _httpClient)
         {
-            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Action>>($"http://localhost:39476/api/WorkflowEngine/GetActions?workflowId={workflowId}");
+            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.Action>>($"{strAPIBaseUri}/api/WorkflowEngine/GetActions?workflowId={workflowId}");
             return ret;
         }
 
         public async Task<List<entity.workflowDefine.TrasferCondition>> GetTransfers(int workflowId, HttpClient _httpClient)
         {
-            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.TrasferCondition>>($"http://localhost:39476/api/WorkflowEngine/GetTrasfers?workflowId={workflowId}");
+            var ret = await _httpClient.GetFromJsonAsync<List<entity.workflowDefine.TrasferCondition>>($"{strAPIBaseUri}/api/WorkflowEngine/GetTrasfers?workflowId={workflowId}");
             return ret;
         }
         private async  Task SaveStaff(Staff obj)
         {
             HttpClient http = new HttpClient();
-            var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"http://localhost:39476/api/Staff/Save", obj);
+            var data = await http.PostAsJsonAsync<wispro.sp.entity.Staff>($"{strAPIBaseUri}/api/Staff/Save", obj);
             if (data.IsSuccessStatusCode)
             {
                 ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
@@ -737,7 +746,7 @@ namespace wispro.sp.winClient
         private async Task SaveBasePointRule(BasePointRule obj)
         {
             HttpClient http = new HttpClient();
-            var data = await http.PostAsJsonAsync<BasePointRule>($"http://localhost:39476/api/BasePointRule/New", obj);
+            var data = await http.PostAsJsonAsync<BasePointRule>($"{strAPIBaseUri}/api/BasePointRule/New", obj);
             if (data.IsSuccessStatusCode)
             {
                 ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
@@ -766,12 +775,12 @@ namespace wispro.sp.winClient
             }
             
 
-            var isExist = await http.PostAsJsonAsync<PerformanceItem>($"http://localhost:39476/api/PerformanceItem/IsExist", obj);
+            var isExist = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/IsExist", obj);
 
             if (isExist.IsSuccessStatusCode && await isExist.Content.ReadFromJsonAsync<bool>()==false)
             {
 
-                var data = await http.PostAsJsonAsync<PerformanceItem>($"http://localhost:39476/api/PerformanceItem/New", obj);
+                var data = await http.PostAsJsonAsync<PerformanceItem>($"{strAPIBaseUri}/api/PerformanceItem/New", obj);
                 if (data.IsSuccessStatusCode)
                 {
                     ApiSaveResponse result = await data.Content.ReadFromJsonAsync<ApiSaveResponse>();
@@ -795,14 +804,14 @@ namespace wispro.sp.winClient
         private async Task<List<StaffGrade>> GetStaffGrades()
         {
             HttpClient http = new HttpClient();
-            var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"http://localhost:39476/api/StaffGrade/GetAll");
+            var _StaffGrade = await http.GetFromJsonAsync<List<StaffGrade>>($"{strAPIBaseUri}/api/StaffGrade/GetAll");
             return _StaffGrade;
         }
 
         private async Task<List<Staff>> GetStaffsAsync()
         {
             HttpClient http = new HttpClient();
-            ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"http://localhost:39476/api/Staff/Query?pageIndex=1&pageSize=200");
+            ListApiResponse<Staff> data = await http.GetFromJsonAsync<ListApiResponse<Staff>>($"{strAPIBaseUri}/api/Staff/Query?pageIndex=1&pageSize=200");
 
             return data.Results;