WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2e039f01-75fb-4752-a777-4084d6de71ac.vsidxBinary files differ
WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/7dc1175d-35b9-490c-9810-66c8a03b0b35.vsidxBinary files differ
WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/ISys_MenuService.cs
@@ -12,6 +12,7 @@ public interface ISys_MenuService : IService<Sys_Menu> { object GetCurrentMenuActionList(); object GetMenuActionList(int roleId); List<Sys_Menu> GetUserMenuList(int roleId); WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_DictionaryRepository.cs
@@ -23,22 +23,22 @@ /// <param name="dicNos"></param> /// <param name="executeSql">是否执行自定义sql</param> /// <returns></returns> public IEnumerable<Sys_Dictionary> GetDictionaries(IEnumerable<string> dicNos, bool executeSql = true) public IEnumerable<Sys_Dictionary> GetDictionaries(IEnumerable<string> dicNos, bool executeSql = false) { List<Sys_Dictionary> Dictionaries = GetAllDictionary(); List<Sys_Dictionary> Dictionaries = GetAllDictionary(dicNos); foreach (var item in Dictionaries.Where(x => dicNos.Contains(x.DicNo))) { if (executeSql) { // 2020.05.01增加根据用户信息加载字典数据源sql string sql = item.DBSql; if (!string.IsNullOrEmpty(sql)) { item.DicList = Query(sql); } } } //foreach (var item in Dictionaries.Where(x => dicNos.Contains(x.DicNo))) //{ // if (executeSql) // { // // 2020.05.01增加根据用户信息加载字典数据源sql // string sql = item.DBSql; // if (!string.IsNullOrEmpty(sql)) // { // item.DicList = Query(sql); // } // } //} return Dictionaries; } @@ -59,10 +59,10 @@ } } private List<Sys_Dictionary> GetAllDictionary() private List<Sys_Dictionary> GetAllDictionary(IEnumerable<string> dicNos) { //base.QueryData().ToList(); List<Sys_Dictionary> _dictionaries = Db.Queryable<Sys_Dictionary>().Includes(x => x.DicList).Where(x => x.Enable == 1).ToList(); List<Sys_Dictionary> _dictionaries = Db.Queryable<Sys_Dictionary>().Includes(x => x.DicList).Where(x => x.Enable == 1 && dicNos.Contains(x.DicNo)).ToList(); return _dictionaries; } } WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
@@ -1,12 +1,18 @@ using Newtonsoft.Json; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core.BaseRepository; using WIDESEAWCS_Core.BaseServices; using WIDESEAWCS_Core.Caches; using WIDESEAWCS_Core.DB; using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.System; using WIDESEAWCS_ISystemRepository; @@ -18,37 +24,92 @@ public class Sys_DictionaryService : ServiceBase<Sys_Dictionary, ISys_DictionaryRepository>, ISys_DictionaryService { private readonly IUnitOfWorkManage _unitOfWorkManage; public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) private readonly ICacheService _cacheService; public Sys_DictionaryService(ISys_DictionaryRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService) : base(BaseDal) { _unitOfWorkManage = unitOfWorkManage; _cacheService = cacheService; } public List<VueDictionaryDTO> GetVueDictionary(string[] dicNos) { if (dicNos == null || dicNos.Count() == 0) return new List<VueDictionaryDTO>(); List<VueDictionaryDTO> vueDictionaryDTOs = new List<VueDictionaryDTO>(); var dicConfig = BaseDal.GetDictionaries(dicNos, false).Select(s => new List<string> cacheDicNos = new List<string>(); foreach (string n in dicNos) { dicNo = s.DicNo, config = s.Config, dbSql = s.DBSql, list = s.DicList.OrderByDescending(o => o.OrderNo).Select(list => new { key = list.DicValue, value = list.DicName }) string str = _cacheService.Get(n); if (!string.IsNullOrEmpty(str)) { VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str); if (vueDictionary != null) { vueDictionaryDTOs.Add(vueDictionary); cacheDicNos.Add(n); } } } if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0) { List<string> list = dicNos.Where(x => !cacheDicNos.Contains(x)).ToList(); List<Sys_Dictionary> dictionaries = BaseDal.GetDictionaries(list).ToList(); List<VueDictionaryDTO> selectDics = dictionaries.Select(s => new VueDictionaryDTO { DicNo = s.DicNo, Config = s.Config, //dbSql = s.Sql, Data = s.DicList.OrderByDescending(o => o.OrderNo).Select(list => new { key = list.DicValue, value = list.DicName }) }).ToList(); object GetSourceData(string dicNo, string dbSql, object data) foreach (var v in dictionaries) { if (string.IsNullOrEmpty(dbSql)) if (!string.IsNullOrEmpty(v.DBSql)) { return data; } return BaseDal.QueryObjectDataBySql(dbSql, null); } return dicConfig.Select(item => new VueDictionaryDTO VueDictionaryDTO? temp = selectDics.FirstOrDefault(x => x.DicNo == v.DicNo); if (temp != null) selectDics.Remove(temp); selectDics.Add(new VueDictionaryDTO { DicNo = item.dicNo, Config = item.config, Data = GetSourceData(item.dicNo, item.dbSql, item.list) }).ToList(); Config = v.Config, DicNo = v.DicNo, Data = BaseDal.QueryDynamicDataBySql(v.DBSql) }); } } foreach (var item in selectDics) { if (!_cacheService.Exists(item.DicNo)) { _cacheService.Add(item.DicNo, item.Serialize()); } } vueDictionaryDTOs.AddRange(selectDics); } //object GetSourceData(string dicNo, string dbSql, object data) //{ // if (string.IsNullOrEmpty(dbSql)) // { // return data; // } // return BaseDal.QueryObjectDataBySql(dbSql, null); //} //List<VueDictionaryDTO> vueDictionaryDTOs = dicConfig.Select(item => new VueDictionaryDTO //{ // DicNo = item.dicNo, // Config = item.config, // Data = GetSourceData(item.dicNo, item.dbSql, item.list) //}).ToList(); return vueDictionaryDTOs; } } } WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs
@@ -192,7 +192,7 @@ x.AuthValue = ""; }); //将取消的权限设置为"" _RoleAuthRepository.UpdateData(delAuths); _RoleAuthRepository.DeleteData(delAuths); int addCount = updateAuths.Where(x => x.AuthId <= 0).Count(); int updateCount = updateAuths.Where(x => x.AuthId > 0).Count(); WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs
@@ -18,10 +18,12 @@ { private readonly IUnitOfWorkManage _unitOfWorkManage; private readonly ICacheService _cacheService; public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService) : base(repository) private readonly ISys_MenuService _menuService; public Sys_UserService(ISys_UserRepository repository, IUnitOfWorkManage unitOfWorkManage, ICacheService cacheService, ISys_MenuService menuService) : base(repository) { _unitOfWorkManage = unitOfWorkManage; _cacheService = cacheService; _menuService = menuService; } public WebResponseContent Login(LoginInfo loginInfo) @@ -47,6 +49,16 @@ UserInfo user = BaseDal.GetUserInfo(loginInfo.UserName, loginInfo.Password); if (user != null) { object obj = _menuService.GetMenuActionList(user.RoleId); if (obj is not IEnumerable<object> list) { return WebResponseContent.Instance.Error("无登录权限"); } if (!list.Any()) { return WebResponseContent.Instance.Error("无登录权限"); } string token = JwtHelper.IssueJwt(new TokenModelJwt() { UserId = user.UserId, WIDESEAWCS_Server/WIDESEAWCS_Tasks/WIDESEAWCS_Tasks.csproj
@@ -7,7 +7,7 @@ </PropertyGroup> <ItemGroup> <PackageReference Include="WIDESEAWCS_QuartzJob" Version="1.0.0" /> <PackageReference Include="WIDESEAWCS_QuartzJob" Version="2.0.3" /> </ItemGroup> <ItemGroup>