parent
1278fed18d
commit
a414aecac3
|
|
@ -48,10 +48,8 @@ namespace Learn.Archives.API.Controllers
|
||||||
? ["*:*:*"]
|
? ["*:*:*"]
|
||||||
: await menuRelationDB.AsQueryable()
|
: await menuRelationDB.AsQueryable()
|
||||||
.LeftJoin<Menu>((mr, m) => mr.MenuId == m.Id)
|
.LeftJoin<Menu>((mr, m) => mr.MenuId == m.Id)
|
||||||
.Where((mr, m) => mr.RoleId == admin.RoleId)
|
.Where((mr, m) => mr.RoleId == admin.RoleId && m.IsButton)
|
||||||
.Select((mr, m) => m)
|
.Select((mr, m) => m.Auths)
|
||||||
.Where(m =>m.IsButton)
|
|
||||||
.Select(m=>m.Auths)
|
|
||||||
.ToArrayAsync();
|
.ToArrayAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -65,6 +63,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
NickName = admin.Name,
|
NickName = admin.Name,
|
||||||
AccessToken = JwtHelper.GetToken(AppCommon.Config.AuthKey,
|
AccessToken = JwtHelper.GetToken(AppCommon.Config.AuthKey,
|
||||||
[
|
[
|
||||||
|
new Claim(ClaimEnum.UserCenterRole,"1"),//让所有用户都有用户中心操作权限
|
||||||
new Claim(ClaimEnum.Role,admin.RoleId.ToString()),
|
new Claim(ClaimEnum.Role,admin.RoleId.ToString()),
|
||||||
new Claim(ClaimEnum.UserId,admin.RoleId.ToString()),
|
new Claim(ClaimEnum.UserId,admin.RoleId.ToString()),
|
||||||
new Claim(ClaimEnum.Id, admin.Id.ToString()),
|
new Claim(ClaimEnum.Id, admin.Id.ToString()),
|
||||||
|
|
@ -73,6 +72,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override Task<bool> Edit([FromBody] Admin model)
|
public override Task<bool> Edit([FromBody] Admin model)
|
||||||
{
|
{
|
||||||
//创建用户时 密码加密
|
//创建用户时 密码加密
|
||||||
|
|
|
||||||
|
|
@ -1,77 +1,83 @@
|
||||||
using MiniExcelLibs.Attributes;
|
using Learn.Archives.Core.Model;
|
||||||
|
using MiniExcelLibs.Attributes;
|
||||||
|
|
||||||
namespace Learn.Archives.API.Controllers.Dto
|
namespace Learn.Archives.API.Controllers.Dto
|
||||||
{
|
{
|
||||||
public class SchoolBusinessDto
|
public class SchoolBusinessDto: SchoolBusiness
|
||||||
{
|
{
|
||||||
|
public string? StartTimeStr => StartTime.ToString("yyyy-MM-dd");
|
||||||
|
/// <summary>
|
||||||
|
/// 可以操作数据?
|
||||||
|
/// </summary>
|
||||||
|
public bool CanOperate { get; set; }
|
||||||
}
|
}
|
||||||
public class SchoolBusinessImportError : SchoolBusinessImport
|
public class SchoolBusinessImportError : SchoolBusinessImport
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
[ExcelColumnName("错误信息")]
|
[ExcelColumn(Name = "错误信息", Width = 50)]
|
||||||
public string Error { get; set; }
|
public string Error { get; set; }
|
||||||
}
|
}
|
||||||
public class SchoolBusinessImport
|
public class SchoolBusinessImport
|
||||||
{
|
{
|
||||||
|
|
||||||
[ExcelColumnName("学校")]
|
[ExcelColumn(Name = "学校", Width = 15)]
|
||||||
public string School { get; set; }
|
public string School { get; set; }
|
||||||
[ExcelColumnName("年级")]
|
[ExcelColumn(Name = "年级", Width = 15)]
|
||||||
public string Grade { get; set; }
|
public string Grade { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 赴校人员
|
/// 赴校人员
|
||||||
/// <para>多个,分割</para>
|
/// <para>多个,分割</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ExcelColumnName("赴校人员")]
|
[ExcelColumn(Name = "赴校人员", Width = 27)]
|
||||||
public string Users { get; set; }
|
public string Users { get; set; }
|
||||||
[ExcelColumnName("赴校时间")]
|
[ExcelColumn(Name = "赴校时间", Width = 15)]
|
||||||
public DateTime StartTime { get; set; }
|
public DateTime StartTime { get; set; }
|
||||||
[ExcelColumnName("开展会谈")]
|
[ExcelColumnName("开展会谈")]
|
||||||
public bool IsDiscussion { get; set; }
|
public string IsDiscussion { get; set; }
|
||||||
|
|
||||||
[ExcelColumnName("开展会谈情况")]
|
[ExcelColumn(Name = "开展会谈情况",Width =27)]
|
||||||
public string Discussion { get; set; }
|
public string Discussion { get; set; }
|
||||||
|
|
||||||
[ExcelColumnName("开展班会")]
|
[ExcelColumnName("开展班会")]
|
||||||
public bool IsClassMeeting { get; set; }
|
public string IsClassMeeting { get; set; }
|
||||||
[ExcelColumnName("开展班会情况")]
|
[ExcelColumn(Name = "开展班会情况", Width = 27)]
|
||||||
public string ClassMeeting { get; set; }
|
public string ClassMeeting { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//----------------------------问题列表
|
//----------------------------问题列表
|
||||||
[ExcelColumnName("[问题]学校领导班子")]
|
[ExcelColumn(Name = "[问题]学校领导班子", Width = 30)]
|
||||||
public string Q学校领导班子 { get; set; }
|
public string Q学校领导班子 { get; set; }
|
||||||
[ExcelColumnName("[问题]双师课堂")]
|
[ExcelColumn(Name = "[问题]双师课堂", Width = 30)]
|
||||||
public string Q双师课堂 { get; set; }
|
public string Q双师课堂 { get; set; }
|
||||||
[ExcelColumnName("[问题]设备")]
|
[ExcelColumn(Name = "[问题]设备", Width = 30)]
|
||||||
public string Q设备 { get; set; }
|
public string Q设备 { get; set; }
|
||||||
[ExcelColumnName("[问题]学生")]
|
[ExcelColumn(Name = "[问题]学生", Width = 30)]
|
||||||
public string Q学生 { get; set; }
|
public string Q学生 { get; set; }
|
||||||
[ExcelColumnName("[问题]其他")]
|
[ExcelColumn(Name = "[问题]其他", Width = 30)]
|
||||||
public string Q其他 { get; set; }
|
public string Q其他 { get; set; }
|
||||||
|
|
||||||
//----------------------------解决办法
|
//----------------------------解决办法
|
||||||
[ExcelColumnName("[解决]学校领导班子")]
|
[ExcelColumn(Name = "[解决]学校领导班子", Width = 30)]
|
||||||
public string P学校领导班子 { get; set; }
|
public string P学校领导班子 { get; set; }
|
||||||
[ExcelColumnName("[解决]双师课堂")]
|
[ExcelColumn(Name = "[解决]双师课堂", Width = 30)]
|
||||||
public string P双师课堂 { get; set; }
|
public string P双师课堂 { get; set; }
|
||||||
[ExcelColumnName("[解决]设备")]
|
[ExcelColumn(Name = "[解决]设备", Width = 30)]
|
||||||
public string P设备 { get; set; }
|
public string P设备 { get; set; }
|
||||||
[ExcelColumnName("[解决]学生")]
|
[ExcelColumn(Name = "[解决]学生", Width = 30)]
|
||||||
public string P学生 { get; set; }
|
public string P学生 { get; set; }
|
||||||
[ExcelColumnName("[解决]其他")]
|
[ExcelColumn(Name = "[解决]其他", Width = 30)]
|
||||||
public string P其他 { get; set; }
|
public string P其他 { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//----------------------------额外需求
|
//----------------------------额外需求
|
||||||
[ExcelColumnName("需求/方案")]
|
[ExcelColumn(Name = "需求/方案", Width = 30)]
|
||||||
public string Solution { get; set; }
|
public string Solution { get; set; }
|
||||||
[ExcelColumnName("沟通时间/执行记录")]
|
[ExcelColumn(Name = "沟通时间/执行记录", Width = 30)]
|
||||||
public string Record { get; set; }
|
public string Record { get; set; }
|
||||||
[ExcelColumnName("完结记录")]
|
[ExcelColumn(Name = "完结记录", Width = 30)]
|
||||||
public string EndRecord { get; set; }
|
public string EndRecord { get; set; }
|
||||||
[ExcelColumnName("备注")]
|
[ExcelColumn(Name = "备注", Width = 40)]
|
||||||
public string Remark { get; set; }
|
public string Remark { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,9 @@ namespace Learn.Archives.API.Controllers
|
||||||
EntryPersonId = userInfo.Id,
|
EntryPersonId = userInfo.Id,
|
||||||
BaseSchoolScore = exam.BaseSchoolScore,
|
BaseSchoolScore = exam.BaseSchoolScore,
|
||||||
EntryPerson = userInfo.Name,
|
EntryPerson = userInfo.Name,
|
||||||
|
TestPaperType = exam.TestPaperType,
|
||||||
|
Type = exam.Type,
|
||||||
|
Average1 = exam.BaseSchoolScore,
|
||||||
};
|
};
|
||||||
insertClassInfo.Add(eCInfo);
|
insertClassInfo.Add(eCInfo);
|
||||||
var avgTotal = 0m;
|
var avgTotal = 0m;
|
||||||
|
|
|
||||||
|
|
@ -49,15 +49,14 @@ namespace Learn.Archives.API.Controllers
|
||||||
var rId = userInfo.RoleId;
|
var rId = userInfo.RoleId;
|
||||||
if (rId == 0) Oh.Error("登录了无效的用户");
|
if (rId == 0) Oh.Error("登录了无效的用户");
|
||||||
Menu[] menuArr ;
|
Menu[] menuArr ;
|
||||||
if (userInfo.RoleId == 1)
|
if (userInfo.IsSa)
|
||||||
menuArr = await baseService.AsQueryable()
|
menuArr = await baseService.AsQueryable()
|
||||||
.Where(m => !m.IsButton).ToArrayAsync();
|
.Where(m => !m.IsButton).ToArrayAsync();
|
||||||
else
|
else
|
||||||
menuArr = await menuRelationDB.AsQueryable()
|
menuArr = await menuRelationDB.AsQueryable()
|
||||||
.LeftJoin<Menu>((mr, m) => mr.MenuId == m.Id)
|
.LeftJoin<Menu>((mr, m) => mr.MenuId == m.Id)
|
||||||
.Where((mr, m) => mr.RoleId == userInfo.RoleId)
|
.Where((mr, m) => mr.RoleId == userInfo.RoleId && !m.IsButton)
|
||||||
.Select((mr, m) => m)
|
.Select((mr, m) => m)
|
||||||
.Where(m=>!m.IsButton)
|
|
||||||
.ToArrayAsync();
|
.ToArrayAsync();
|
||||||
return GetChildren(menuArr, 0);
|
return GetChildren(menuArr, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
using Learn.Archives.API.Controllers.Dto;
|
||||||
|
using Learn.Archives.API.Expand;
|
||||||
|
using Learn.Archives.Core.Common;
|
||||||
|
using Learn.Archives.Core.Model;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using UserCenter.Model;
|
||||||
|
|
||||||
|
namespace Learn.Archives.API.Controllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 管理员角色控制器
|
||||||
|
/// </summary>
|
||||||
|
public class MenuRelationController : BackController<MenuRelation>
|
||||||
|
{
|
||||||
|
readonly Repository<AdminRole> roleService;
|
||||||
|
readonly Repository<MenuRelation> mrService;
|
||||||
|
readonly LiveUserInfo userInfo;
|
||||||
|
public MenuRelationController(Repository<AdminRole> baseService, LiveUserInfo userInfo, Repository<MenuRelation> mrService) : base(mrService)
|
||||||
|
{
|
||||||
|
this.roleService = baseService;
|
||||||
|
this.userInfo = userInfo;
|
||||||
|
this.mrService = mrService;
|
||||||
|
}
|
||||||
|
public class SetMenuInput
|
||||||
|
{
|
||||||
|
public long RoleId { get; set; }
|
||||||
|
public long[] MenuId { get; set; }
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取角色菜单ids
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<long[]> RoleMenu(long roleId)
|
||||||
|
{
|
||||||
|
if (roleId == 0) Oh.Error("无效的角色");
|
||||||
|
if (!userInfo.IsSa) Oh.Error("无权访问");
|
||||||
|
var role = roleService.GetByIdAsync(roleId);
|
||||||
|
if (role == null) Oh.Error("无效的角色");
|
||||||
|
return await mrService.AsQueryable()
|
||||||
|
.Where(s=>s.RoleId==roleId)
|
||||||
|
.Select(s=>s.MenuId)
|
||||||
|
.ToArrayAsync();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置角色菜单
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<bool> SetMenu(SetMenuInput input)
|
||||||
|
{
|
||||||
|
if (input.MenuId == null || input.MenuId.Length==0) Oh.Error("选择了无可用的菜单");
|
||||||
|
if (!userInfo.IsSa) Oh.Error("登录了无效的用户");
|
||||||
|
var role = await roleService.GetByIdAsync(input.RoleId);
|
||||||
|
if (role == null) Oh.Error("无效的角色");
|
||||||
|
var insertData= input.MenuId!
|
||||||
|
.Select(s=>new MenuRelation() {RoleId = role!.Id,MenuId = s })
|
||||||
|
.ToArray();
|
||||||
|
await mrService.AsDeleteable().Where(s=>s.RoleId == role!.Id).ExecuteCommandAsync();
|
||||||
|
return await mrService.InsertRangeAsync(insertData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,6 +4,7 @@ using Learn.Archives.Core.Common;
|
||||||
using Learn.Archives.Core.Model;
|
using Learn.Archives.Core.Model;
|
||||||
using Learn.Archives.Core.Model.Dto;
|
using Learn.Archives.Core.Model.Dto;
|
||||||
using Learn.Archives.Core.Model.Enum;
|
using Learn.Archives.Core.Model.Enum;
|
||||||
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using MiniExcelLibs;
|
using MiniExcelLibs;
|
||||||
|
|
@ -24,12 +25,14 @@ namespace Learn.Archives.API.Controllers
|
||||||
readonly Repository<School> schoolService;
|
readonly Repository<School> schoolService;
|
||||||
readonly Repository<Core.Model.Admin> adminService;
|
readonly Repository<Core.Model.Admin> adminService;
|
||||||
readonly IHttpContextAccessor accessor;
|
readonly IHttpContextAccessor accessor;
|
||||||
public SchoolBusinessController(Repository<SchoolBusiness> baseService, Repository<School> schoolService, IHttpContextAccessor accessor, Repository<Core.Model.Admin> adminService) : base(baseService)
|
readonly LiveUserInfo userInfo;
|
||||||
|
public SchoolBusinessController(Repository<SchoolBusiness> baseService, Repository<School> schoolService, IHttpContextAccessor accessor, Repository<Core.Model.Admin> adminService, LiveUserInfo userInfo) : base(baseService)
|
||||||
{
|
{
|
||||||
this.baseService = baseService;
|
this.baseService = baseService;
|
||||||
this.schoolService = schoolService;
|
this.schoolService = schoolService;
|
||||||
this.accessor = accessor;
|
this.accessor = accessor;
|
||||||
this.adminService = adminService;
|
this.adminService = adminService;
|
||||||
|
this.userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QueryPageDto
|
public class QueryPageDto
|
||||||
|
|
@ -45,7 +48,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 赴校人员ID
|
/// 赴校人员ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long? UserId { get; set; }
|
public string? UserName{ get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否查询完结
|
/// 是否查询完结
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -77,15 +80,18 @@ namespace Learn.Archives.API.Controllers
|
||||||
return base.Edit(model);
|
return base.Edit(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override async Task<dynamic> Info(long id)
|
||||||
|
{
|
||||||
|
return (await base.Info(id) as object).Adapt<SchoolBusinessDto>();
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询 赴校列表
|
/// 查询 赴校列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<PageResult<SchoolBusiness>> QueryPageList(QueryPageDto dto)
|
public async Task<PageResult<SchoolBusinessDto>> QueryPageList(QueryPageDto dto)
|
||||||
{
|
{
|
||||||
|
|
||||||
var uid = dto.UserId.ToString();
|
|
||||||
var gInfo = GradeHelper.GetStudentGradeBaseByGrade(dto.Grade);
|
var gInfo = GradeHelper.GetStudentGradeBaseByGrade(dto.Grade);
|
||||||
RefAsync<int> total = 0;
|
RefAsync<int> total = 0;
|
||||||
var resData = await baseService.AsQueryable()
|
var resData = await baseService.AsQueryable()
|
||||||
|
|
@ -94,10 +100,13 @@ namespace Learn.Archives.API.Controllers
|
||||||
.WhereIF(dto.SolutionEnd != null, s => s.SolutionEnd == dto.SolutionEnd)
|
.WhereIF(dto.SolutionEnd != null, s => s.SolutionEnd == dto.SolutionEnd)
|
||||||
.WhereIF(dto.StartTime != null, s => s.StartTime >= dto.StartTime)
|
.WhereIF(dto.StartTime != null, s => s.StartTime >= dto.StartTime)
|
||||||
.WhereIF(dto.EndTime != null, s => s.StartTime <= dto.EndTime)
|
.WhereIF(dto.EndTime != null, s => s.StartTime <= dto.EndTime)
|
||||||
.WhereIF(uid != null, s => s.SchoolBusinessUser != null && SqlFunc.JsonLike(s.SchoolBusinessUser, uid))
|
.WhereIF(!string.IsNullOrEmpty(dto.UserName), s => s.SchoolBusinessUser != null && SqlFunc.JsonLike(s.SchoolBusinessUser, dto.UserName))
|
||||||
.OrderByDescending(s => s.Id)
|
.OrderByDescending(s => s.Id)
|
||||||
|
.Select<SchoolBusinessDto>()
|
||||||
.ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
.ToPageListAsync(dto.PageIndex, dto.PageSize, total);
|
||||||
return new PageResult<SchoolBusiness>() { Data = resData, Total = total };
|
foreach (var item in resData)
|
||||||
|
item.CanOperate =userInfo.IsSa || (item.SchoolBusinessUser?.Contains(userInfo.Name) ?? false);
|
||||||
|
return new PageResult<SchoolBusinessDto>() { Data = resData, Total = total };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -157,7 +166,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
}
|
}
|
||||||
var adminArr = await adminService.AsQueryable()
|
var adminArr = await adminService.AsQueryable()
|
||||||
.Where(s => adminNameArr.Contains(s.Name))
|
.Where(s => adminNameArr.Contains(s.Name))
|
||||||
.Select(s => s.Id).ToArrayAsync();
|
.Select(s => s.Name).ToArrayAsync();
|
||||||
var qStr = new Dictionary<FeedbackQuestionTypeEnum, (string Questions, string Solutions)>()
|
var qStr = new Dictionary<FeedbackQuestionTypeEnum, (string Questions, string Solutions)>()
|
||||||
{
|
{
|
||||||
{FeedbackQuestionTypeEnum.学校领导班子,(imp.Q学校领导班子,imp.P学校领导班子) },
|
{FeedbackQuestionTypeEnum.学校领导班子,(imp.Q学校领导班子,imp.P学校领导班子) },
|
||||||
|
|
@ -173,6 +182,8 @@ namespace Learn.Archives.API.Controllers
|
||||||
var questionType = kvp.Key;
|
var questionType = kvp.Key;
|
||||||
var questions = kvp.Value.Questions;
|
var questions = kvp.Value.Questions;
|
||||||
var solutions = kvp.Value.Solutions;
|
var solutions = kvp.Value.Solutions;
|
||||||
|
if (string.IsNullOrEmpty(questions) || string.IsNullOrEmpty(solutions))
|
||||||
|
continue;
|
||||||
// 解析问题
|
// 解析问题
|
||||||
var questionMatches = regex.Matches(questions);
|
var questionMatches = regex.Matches(questions);
|
||||||
var solutionMatches = regex.Matches(solutions);
|
var solutionMatches = regex.Matches(solutions);
|
||||||
|
|
@ -236,6 +247,8 @@ namespace Learn.Archives.API.Controllers
|
||||||
Record = record,
|
Record = record,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
business.SolutionEnd = business.SolutionRecord.EndRecordTime != null;
|
||||||
|
insertInfo.Add(business);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -243,7 +256,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
return File(errorExcelInfo.ExportExcel(), "application/ms-excel");
|
return File(errorExcelInfo.ExportExcel(), "application/ms-excel");
|
||||||
|
|
||||||
//写入数据库
|
//写入数据库
|
||||||
|
await baseService.InsertRangeAsync(insertInfo);
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +268,7 @@ namespace Learn.Archives.API.Controllers
|
||||||
public IActionResult DwImportTemplate()
|
public IActionResult DwImportTemplate()
|
||||||
{
|
{
|
||||||
var resultList = new List<SchoolBusinessImport>() { new SchoolBusinessImport() { } };
|
var resultList = new List<SchoolBusinessImport>() { new SchoolBusinessImport() { } };
|
||||||
return File(resultList.ExportExcel(), "application/ms-excel");
|
return File(resultList.ExportExcel(), "application/ms-excel", "导入赴校信息模板.xlsx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Hosting;
|
||||||
using Learn.Archives.Core.Common;
|
using Learn.Archives.Core.Common;
|
||||||
using Learn.Archives.Core.Model.Dto;
|
using Learn.Archives.Core.Model.Dto;
|
||||||
using Learn.Archives.Core.Model;
|
using Learn.Archives.Core.Model;
|
||||||
|
using SqlSugar.IOC;
|
||||||
|
|
||||||
namespace Learn.Archives.API.Expand
|
namespace Learn.Archives.API.Expand
|
||||||
{
|
{
|
||||||
|
|
@ -40,13 +41,11 @@ namespace Learn.Archives.API.Expand
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HttpLogAttribute : ActionFilterAttribute, IAsyncExceptionFilter
|
public class HttpLogAttribute : ActionFilterAttribute, IAsyncExceptionFilter
|
||||||
{
|
{
|
||||||
readonly Repository<HttpLog> logService;
|
|
||||||
readonly LiveUserInfo userInfo;
|
readonly LiveUserInfo userInfo;
|
||||||
readonly Stopwatch _stopwatch;//统计程序耗时
|
readonly Stopwatch _stopwatch;//统计程序耗时
|
||||||
|
|
||||||
public HttpLogAttribute(Repository<HttpLog> logService, LiveUserInfo userInfo)
|
public HttpLogAttribute( LiveUserInfo userInfo)
|
||||||
{
|
{
|
||||||
this.logService = logService;
|
|
||||||
_stopwatch = Stopwatch.StartNew();
|
_stopwatch = Stopwatch.StartNew();
|
||||||
this.userInfo = userInfo;
|
this.userInfo = userInfo;
|
||||||
}
|
}
|
||||||
|
|
@ -174,7 +173,7 @@ namespace Learn.Archives.API.Expand
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//写入队列
|
//写入队列
|
||||||
await logService.InsertAsync(new HttpLog
|
await DbScoped.Sugar.Insertable<HttpLog>(new HttpLog
|
||||||
{
|
{
|
||||||
Id = logId,
|
Id = logId,
|
||||||
Url = context.Request.Path + context.Request.QueryString,
|
Url = context.Request.Path + context.Request.QueryString,
|
||||||
|
|
@ -190,7 +189,7 @@ namespace Learn.Archives.API.Expand
|
||||||
ExceptionMessage = e?.Message,
|
ExceptionMessage = e?.Message,
|
||||||
AdminId = userInfo.Id,
|
AdminId = userInfo.Id,
|
||||||
TotalMilliseconds = (double)_stopwatch.Elapsed.TotalMilliseconds
|
TotalMilliseconds = (double)_stopwatch.Elapsed.TotalMilliseconds
|
||||||
});
|
}).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@
|
||||||
public static string PositionId => "position";
|
public static string PositionId => "position";
|
||||||
public static string UserId => "user";
|
public static string UserId => "user";
|
||||||
public static string Id => "id";
|
public static string Id => "id";
|
||||||
public static string Role => "role";
|
public static string UserCenterRole => "role";
|
||||||
|
public static string Role => "role1";
|
||||||
public static string Scope => "scope";
|
public static string Scope => "scope";
|
||||||
public static string Name => "name";
|
public static string Name => "name";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,13 @@ namespace Learn.Archives.Core.Common
|
||||||
{
|
{
|
||||||
get => long.Parse(_httpContextAccessor.HttpContext?.User.FindFirst(ClaimEnum.Role)?.Value ?? "0");
|
get => long.Parse(_httpContextAccessor.HttpContext?.User.FindFirst(ClaimEnum.Role)?.Value ?? "0");
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 是超管?
|
||||||
|
/// </summary>
|
||||||
|
public bool IsSa
|
||||||
|
{
|
||||||
|
get => RoleId == 1;
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 管理员id
|
/// 管理员id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ namespace Learn.Archives.Core.Model
|
||||||
public class Admin : EntityBaseId, IDB
|
public class Admin : EntityBaseId, IDB
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 账号
|
/// 名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 12)]
|
[SugarColumn(Length = 12)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ namespace Learn.Archives.Core.Model.Dto
|
||||||
/// 添加完结时间
|
/// 添加完结时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EndRecordTime { get; set; }
|
public DateTime? EndRecordTime { get; set; }
|
||||||
|
public string? ExecutionTimeStr => EndRecordTime?.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行记录
|
/// 执行记录
|
||||||
|
|
@ -48,6 +50,8 @@ namespace Learn.Archives.Core.Model.Dto
|
||||||
/// 执行时间
|
/// 执行时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? ExecutionTime { get; set; }
|
public DateTime? ExecutionTime { get; set; }
|
||||||
|
public string? ExecutionTimeStr => ExecutionTime?.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,6 +82,9 @@ namespace Learn.Archives.Core.Model.Dto
|
||||||
/// 解决时间
|
/// 解决时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EndTime { get; set; }
|
public DateTime? EndTime { get; set; }
|
||||||
|
public string? EndTimeStr=> EndTime?.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -97,5 +104,7 @@ namespace Learn.Archives.Core.Model.Dto
|
||||||
/// 解决时间
|
/// 解决时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime? EndTime { get; set; }
|
public DateTime? EndTime { get; set; }
|
||||||
|
public string? EndTimeStr => EndTime?.ToString("yyyy-MM-dd");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,24 @@ namespace Learn.Archives.Core.Model
|
||||||
/// 考试班级id
|
/// 考试班级id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long ClassId { get; set; }
|
public long ClassId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 考试班级名称
|
/// 考试班级名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 20)]
|
[SugarColumn(Length = 20)]
|
||||||
public string ClassName { get; set; }
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 试卷类型
|
||||||
|
/// </summary>
|
||||||
|
public TestPaperTypeEnum TestPaperType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 考试类型
|
||||||
|
/// </summary>
|
||||||
|
public ExamTypeEnum Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 考试班级所属学校ID
|
/// 考试班级所属学校ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ namespace Learn.Archives.Core.Model
|
||||||
/// 赴校人员 逗号分隔
|
/// 赴校人员 逗号分隔
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsNullable = true, IsJson = true)]
|
[SugarColumn(IsNullable = true, IsJson = true)]
|
||||||
public long[]? SchoolBusinessUser { get; set; }
|
public string[]? SchoolBusinessUser { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 赴校时间
|
/// 赴校时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue