dev #15

Merged
hy merged 3 commits from dev into staging 2025-09-14 15:46:47 +08:00
4 changed files with 76 additions and 4 deletions
Showing only changes of commit abcdad03b0 - Show all commits

View File

@ -10,7 +10,9 @@ using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MiniExcelLibs;
using SqlSugar;
using System.Diagnostics;
using System.Linq.Expressions;
using System.Security.Claims;
using System.Text.RegularExpressions;
using UserCenter.Model;
@ -20,20 +22,22 @@ using UserCenter.Model.Enum;
namespace Learn.Archives.API.Controllers
{
/// <summary>
/// 年级控制器
/// 学生接口
/// </summary>
public class StudentController : BackController<Student>
{
private readonly IHttpContextAccessor _httpContextAccessor;
readonly Repository<Student> baseService;
readonly Repository<Position> positionService;
readonly UserCenterService _userCenterService;
readonly LiveUserInfo userInfo;
public StudentController(Repository<Student> baseService, LiveUserInfo userInfo, IHttpContextAccessor httpContextAccessor, UserCenterService userCenterService) : base(baseService)
public StudentController(Repository<Student> baseService, LiveUserInfo userInfo, IHttpContextAccessor httpContextAccessor, UserCenterService userCenterService, Repository<Position> positionService) : base(baseService)
{
this.baseService = baseService;
this.userInfo = userInfo;
_httpContextAccessor = httpContextAccessor;
_userCenterService = userCenterService;
this.positionService = positionService;
}
[NonAction]
@ -54,6 +58,42 @@ namespace Learn.Archives.API.Controllers
Oh.ModelError("无效数据");
return await baseService.AsQueryable().FirstAsync(s => s.UserCenterId == uid);
}
/// <summary>
/// 获取职位id
/// <para> 调用流程 用户中心->档案系统</para>
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<long[]> PosititonIds(PositionIdsReq[] data)
{
if (data == null || data.Count()==0)
Oh.ModelError("无效数据");
var query = new Expressionable<Position>();
foreach (var pos in data)
{
query = query.Or(q =>
q.SchoolId == pos.SchoolId &&
q.PositionType == pos.PositionType &&
q.GradeLevel == pos.GradeLevel &&
q.GraduationYear == pos.GraduationYear &&
q.PositionLevel == pos.PositionLevel
&&
(
// PositionLevel == 3只匹配前三个字段
(pos.PositionLevel == 3) ||
// PositionLevel == 4再加上 ClassId
(pos.PositionLevel == 4 && q.ClassId == pos.ClassId) ||
// PositionLevel == 5再加上 ClassId + SubjectId
(pos.PositionLevel == 5 && q.ClassId == pos.ClassId && q.SubjectId == pos.SubjectId)
)
);
}
return await positionService.AsQueryable()
.Where(query.ToExpression())
.Select(p => p.Id).ToArrayAsync();
}
/// <summary>
/// 修改用户信息

View File

@ -14,7 +14,7 @@
"DB": {
"ConnectionString": "AllowLoadLocalInfile=true;Server=58.17.132.2;User ID=marking;Password=qwe123!@#;Port=3306;Database=learn.archives;CharSet=utf8mb4;Port=43306;pooling=true;SslMode=None;",
"SqlType": "MySql",
"UpdateTable": true
"UpdateTable": false
},
"AuthKey": {
"Secret": "9FAB7AC7-F1DB-4C56-B84F-044055A34AF2",

View File

@ -28,6 +28,6 @@
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="UserCenter.Model" Version="1.4.3" />
<PackageReference Include="UserCenter.Model" Version="1.4.4" />
</ItemGroup>
</Project>

View File

@ -10,6 +10,38 @@ using UserCenter.Model;
namespace Learn.Archives.Core.Model.Dto
{
public class PositionIdsReq
{
/// <summary>
/// 学校编号
/// </summary>
public long SchoolId { get; set; }
/// <summary>
/// 年级
/// </summary>
public string GradeLevel { get; set; }
/// <summary>
/// 毕业届
/// </summary>
public int GraduationYear { get; set; }
/// <summary>
/// 班级编号
/// </summary>
public long? ClassId { get; set; }
/// <summary>
/// 职级
/// </summary>
public int PositionLevel { get; set; }
public int? PositionType { get; set; } = 2;
/// <summary>
/// 科目
/// </summary>
public int? SubjectId { get; set; }
}
public class TeacherInfoImportError : TeacherInfoImport
{
/// <summary>