diff --git a/OpenAuth.App/BaseApp/Category/CategoryApp.cs b/OpenAuth.App/BaseApp/Category/CategoryApp.cs index 9c607cd..c002191 100644 --- a/OpenAuth.App/BaseApp/Category/CategoryApp.cs +++ b/OpenAuth.App/BaseApp/Category/CategoryApp.cs @@ -13,9 +13,11 @@ namespace OpenAuth.App public class CategoryApp : SqlSugarBaseApp { private DbExtension extension; - public CategoryApp(ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth, DbExtension dbExtension) : base(unitWork, repository, auth) + private readonly ISqlSugarClient client; + public CategoryApp(ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth, DbExtension dbExtension, ISqlSugarClient client) : base(unitWork, repository, auth) { extension = dbExtension; + this.client = client; } /// /// 加载列表 @@ -113,5 +115,36 @@ namespace OpenAuth.App { return Repository.GetById(id); } + + #region 原航飞库 + /// + /// 获取字典 + /// + /// + /// + public List LoadList(string typeid) + { + var list = client.Queryable().Where(c => c.ItemCode == typeid).OrderByDescending(c => c.CreateDate) + .Select(c => new App.Request.Category + { + Id = c.ItemDetailId, + Name = c.ItemName, + DtCode = c.ItemCode, + DtValue = c.ItemValue, + SortNo = c.SortCode, + Description = c.Description, + Enable = c.EnabledMark, + TypeId = c.ItemCode, + CreateTime = c.CreateDate, + CreateUserId = c.CreateUserId, + CreateUserName = c.CreateUserName, + UpdateTime = c.ModifyDate, + UpdateUserId = c.ModifyUserId, + UpdateUserName = c.ModifyUserName + }) + .ToList(); + return list; + } + #endregion } } \ No newline at end of file diff --git a/OpenAuth.App/BaseApp/OrgManager/OrgManagerApp.cs b/OpenAuth.App/BaseApp/OrgManager/OrgManagerApp.cs index 424ead0..be47200 100644 --- a/OpenAuth.App/BaseApp/OrgManager/OrgManagerApp.cs +++ b/OpenAuth.App/BaseApp/OrgManager/OrgManagerApp.cs @@ -627,7 +627,45 @@ namespace OpenAuth.App base.Repository.AsSugarClient().Updateable(obj).ExecuteCommand(); } + #region + /// + /// 组织机构列表 + /// + /// + /// + public List LoadOrgList(string name) + { + List resultList = new List(); + var model = client.Queryable().Where(c => c.Name == name).First(); + if (model == null) + { + throw new System.Exception("找不到数据"); + } + + //查询所有子级 + var list = client.Queryable().OrderBy(c => c.SortNo).ToChildList(c => c.ParentId, model.Id).ToList(); + + return list; + } + + /// + /// 查询组织机构对应的数据库和图片列表 + /// + /// + /// + public List LoadDataBase(QueryOrgRelDataBaseReq req) + { + int total = 0; + var list = client.Queryable() + //数据库名称过滤 + .WhereIF(!string.IsNullOrEmpty(req.dataBaseName), c => c.database_name == req.dataBaseName) + //组织机构名称过滤 + .WhereIF(!string.IsNullOrEmpty(req.orgid), c => c.org_id.Contains(req.orgid)) + .ToPageList(req.page, req.limit, ref total); + return list; + } + #endregion } } \ No newline at end of file diff --git a/OpenAuth.App/ServiceApp/Category/CategoryApp.cs b/OpenAuth.App/ServiceApp/Category/CategoryApp.cs deleted file mode 100644 index c8b7225..0000000 --- a/OpenAuth.App/ServiceApp/Category/CategoryApp.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace OpenAuth.App.ServiceApp.Category -{ - public class CategoryApp - { - - } -} diff --git a/OpenAuth.App/ServiceApp/Category/CategoryItemApp.cs b/OpenAuth.App/ServiceApp/Category/CategoryItemApp.cs new file mode 100644 index 0000000..11c10a1 --- /dev/null +++ b/OpenAuth.App/ServiceApp/Category/CategoryItemApp.cs @@ -0,0 +1,96 @@ +using OpenAuth.App.BaseApp.Base; +using OpenAuth.Repository.Domain; +using OpenAuth.Repository; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OpenAuth.App.Interface; +using SqlSugar; +using Infrastructure.Extensions; +using Infrastructure; +using OpenAuth.App.Request; +using OpenAuth.App.Response; + +namespace OpenAuth.App.ServiceApp.Category +{ + public class CategoryItemApp : SqlSugarBaseApp + { + private readonly ISqlSugarClient client; + public CategoryItemApp(ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth, ISqlSugarClient sqlSugarClient) : base(unitWork, repository, auth) + { + this.client = sqlSugarClient; + } + + /// + /// 获取字典 + /// + /// + /// + public List LoadList(string typeid) + { + var list = client.Queryable().Where(c => c.ItemCode == typeid).OrderByDescending(c => c.CreateDate) + .Select(c=>new App.Request.Category + { + Id=c.ItemDetailId, + Name=c.ItemName, + DtCode=c.ItemCode, + DtValue=c.ItemValue, + SortNo=c.SortCode, + Description=c.Description, + Enable=c.EnabledMark, + TypeId=c.ItemCode, + CreateTime=c.CreateDate, + CreateUserId=c.CreateUserId, + CreateUserName=c.CreateUserName, + UpdateTime=c.ModifyDate, + UpdateUserId=c.ModifyUserId, + UpdateUserName=c.ModifyUserName + }) + .ToList(); + return list; + } + + + #region + /// + /// 组织机构列表 + /// + /// + /// + public List LoadOrgList(string name) + { + List resultList = new List(); + + var model = client.Queryable().Where(c => c.Name == name).First(); + if (model == null) + { + throw new System.Exception("找不到数据"); + } + + //查询所有子级 + var list = client.Queryable().OrderBy(c => c.SortNo).ToChildList(c => c.ParentId, model.Id).ToList(); + + return list; + } + + /// + /// 查询组织机构对应的数据库和图片列表 + /// + /// + /// + public List LoadDataBase(QueryOrgRelDataBaseReq req) + { + int total = 0; + var list = client.Queryable() + //数据库名称过滤 + .WhereIF(!string.IsNullOrEmpty(req.dataBaseName), c => c.database_name == req.dataBaseName) + //组织机构名称过滤 + .WhereIF(!string.IsNullOrEmpty(req.orgid), c => c.org_id.Contains(req.orgid)) + .ToPageList(req.page, req.limit, ref total); + return list; + } + #endregion + } +} diff --git a/OpenAuth.App/ServiceApp/Category/Request/Category.cs b/OpenAuth.App/ServiceApp/Category/Request/Category.cs index cd8f37b..8af742f 100644 --- a/OpenAuth.App/ServiceApp/Category/Request/Category.cs +++ b/OpenAuth.App/ServiceApp/Category/Request/Category.cs @@ -14,7 +14,7 @@ namespace OpenAuth.App.Request /// Default:CURRENT_TIMESTAMP /// Nullable:False /// - public DateTime CreateTime { get; set; } + public DateTime? CreateTime { get; set; } /// /// Desc:创建人ID @@ -56,7 +56,7 @@ namespace OpenAuth.App.Request /// Default:0 /// Nullable:False /// - public byte Enable { get; set; } + public int? Enable { get; set; } /// /// Desc: @@ -77,7 +77,7 @@ namespace OpenAuth.App.Request /// Default:0 /// Nullable:False /// - public int SortNo { get; set; } + public int? SortNo { get; set; } /// /// Desc: diff --git a/OpenAuth.App/ServiceApp/Category/Request/Orgs.cs b/OpenAuth.App/ServiceApp/Category/Request/Orgs.cs new file mode 100644 index 0000000..056101f --- /dev/null +++ b/OpenAuth.App/ServiceApp/Category/Request/Orgs.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.ServiceApp.Category.Request +{ + public class Orgs + { + public string Id { get; set; } + public string CascadeId { get; set; } + public string Name { get; set; } + public string HotKey { get; set; } + public string ParentName { get; set; } + public int? IsLeaf { get; set; } + public int? IsAutoExpand { get; set; } + public string IconName { get; set; } + public int? Status { get; set; } + public string BizCode { get; set; } + public string CustomCode { get; set; } + public DateTime? CreateTime { get; set; } + public int? CreateId { get; set; } + public int? SortNo { get; set; } + public string ParentId { get; set; } + public string TypeName { get; set; } + public string TypeId { get; set; } + } +} diff --git a/OpenAuth.App/ServiceApp/Category/Request/QueryOrgRelDataBaseReq.cs b/OpenAuth.App/ServiceApp/Category/Request/QueryOrgRelDataBaseReq.cs new file mode 100644 index 0000000..61304e2 --- /dev/null +++ b/OpenAuth.App/ServiceApp/Category/Request/QueryOrgRelDataBaseReq.cs @@ -0,0 +1,23 @@ +using OpenAuth.App.BaseApp.Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace OpenAuth.App.Request +{ + public class QueryOrgRelDataBaseReq : PageReq + { + /// + /// 数据库名称 + /// + public string dataBaseName { get; set; } + + /// + /// 组织机构id + /// + public string orgid { get; set; } + + } +} diff --git a/OpenAuth.App/ServiceApp/InsTaskHallManager/InsTaskHallApp.cs b/OpenAuth.App/ServiceApp/InsTaskHallManager/InsTaskHallApp.cs index 8aa35f0..f6e9219 100644 --- a/OpenAuth.App/ServiceApp/InsTaskHallManager/InsTaskHallApp.cs +++ b/OpenAuth.App/ServiceApp/InsTaskHallManager/InsTaskHallApp.cs @@ -232,7 +232,7 @@ namespace OpenAuth.App.ServiceApp.InsTaskHallManager { throw new Exception("登录失效"); } - + var taskId = ""; using(var uwo = UnitWork.CreateContext()) { foreach (var item in groupIds) @@ -241,6 +241,7 @@ namespace OpenAuth.App.ServiceApp.InsTaskHallManager if (taskGroup != null&&taskGroup.ReciveUserId==null) { var task = await client.Queryable().Where(t => t.Id == taskGroup.TaskId).FirstAsync(); + taskId = task.Id; if(task != null) { //查询并判断任务是否领完 @@ -274,7 +275,7 @@ namespace OpenAuth.App.ServiceApp.InsTaskHallManager var flag = uwo.Commit(); var content = new { - queryid = groupIds, + queryid = taskId, message = "有新接手的任务" }; var contents = Json.ToJson(content); diff --git a/OpenAuth.WebApi/Controllers/BaseControllers/CategorysController.cs b/OpenAuth.WebApi/Controllers/BaseControllers/CategorysController.cs index c99481e..48afc24 100644 --- a/OpenAuth.WebApi/Controllers/BaseControllers/CategorysController.cs +++ b/OpenAuth.WebApi/Controllers/BaseControllers/CategorysController.cs @@ -126,5 +126,29 @@ namespace OpenAuth.WebApi.Controllers { _app = app; } + + #region + /// + /// 获取字典 + /// + /// + /// + [HttpGet] + public Response> LoadList(string typeid) + { + Response> response = new Response>(); + try + { + response.Result = _app.LoadList(typeid); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + + return response; + } + #endregion } } diff --git a/OpenAuth.WebApi/Controllers/BaseControllers/OrgsController.cs b/OpenAuth.WebApi/Controllers/BaseControllers/OrgsController.cs index 6e4a24c..a31f25f 100644 --- a/OpenAuth.WebApi/Controllers/BaseControllers/OrgsController.cs +++ b/OpenAuth.WebApi/Controllers/BaseControllers/OrgsController.cs @@ -1,10 +1,12 @@ using Infrastructure; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using OpenAuth.App; using OpenAuth.App.Request; using OpenAuth.Repository.Core; using OpenAuth.Repository.Domain; using OpenAuth.WebApi.Model.CustomAttribute; +using SqlSugar; namespace OpenAuth.WebApi.Controllers { @@ -283,5 +285,51 @@ namespace OpenAuth.WebApi.Controllers #endregion #endregion + + #region 原航飞库 + /// + /// 获取所有下级组织机构 + /// + /// + /// + [AllowAnonymous] + [HttpGet] + public Response> LoadOrgList(string name) + { + Response> response = new Response>(); + try + { + response.Result = _app.LoadOrgList(name); + } + catch (Exception ex) + { + response.Code = 500; + response.Message = ex.InnerException?.Message ?? ex.Message; + } + return response; + } + + /// + /// 查询组织机构绑定数据库,图片服务器列表 + /// + /// + /// + [HttpGet] + public Response> LoadDataBase([FromQuery] QueryOrgRelDataBaseReq req) + { + var res = new Response>(); + try + { + res.Result = _app.LoadDataBase(req); + } + catch (Exception ex) + { + res.Code = 500; + res.Message = ex.InnerException?.Message ?? ex.Message; + } + + return res; + } + #endregion } } \ No newline at end of file