dd
This commit is contained in:
parent
0849a3eb2b
commit
5e3d8b2f62
19
VOL.Ai/IRepositories/IScanCodeLoginRepository.cs
Normal file
19
VOL.Ai/IRepositories/IScanCodeLoginRepository.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Core.BaseProvider;
|
||||
using VOL.Core.Extensions.AutofacManager;
|
||||
using VOL.Entity.DomainModels;
|
||||
|
||||
namespace VOL.Ai.IRepositories
|
||||
{
|
||||
/// <summary>
|
||||
/// Ai扫码登陆
|
||||
/// </summary>
|
||||
public interface IScanCodeLoginRepository : IDependency, IRepository<Ai_ScanCodeLogin>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
31
VOL.Ai/Repositories/ScanCodeLoginRepository.cs
Normal file
31
VOL.Ai/Repositories/ScanCodeLoginRepository.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using VOL.Ai.IRepositories;
|
||||
using VOL.Business.IRepositories;
|
||||
using VOL.Core.BaseProvider;
|
||||
using VOL.Core.EFDbContext;
|
||||
using VOL.Core.Extensions.AutofacManager;
|
||||
using VOL.Entity.DomainModels;
|
||||
|
||||
namespace VOL.Ai.Repositories
|
||||
{
|
||||
/// <summary>
|
||||
/// Ai扫码登陆
|
||||
/// </summary>
|
||||
public partial class ScanCodeLoginRepository : RepositoryBase<Ai_ScanCodeLogin>, IScanCodeLoginRepository
|
||||
{
|
||||
public ScanCodeLoginRepository(VOLContext dbContext)
|
||||
: base(dbContext)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static IScanCodeLoginRepository Instance
|
||||
{
|
||||
get { return AutofacContainerModule.GetService<IScanCodeLoginRepository>(); }
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace VOL.Ai.Services
|
||||
private readonly IS_ClassRepository _classRepository;
|
||||
private readonly IN_SportsTestCategoryRepository _sportsTestCategoryRepository;
|
||||
private readonly IN_HealthStandardsRepository _healthStandardsRepository;
|
||||
private readonly IN_SportsTestResultRepository _sportsTestResultRepository;
|
||||
private readonly IScanCodeLoginRepository _scanCodeLoginRepository;
|
||||
private readonly IN_SportsTrainingCategoryRepository _sportsTrainingCategoryRepository;
|
||||
private readonly IClassRoomRecordRepository _classRoomRecordRepository;
|
||||
private readonly IHeartRateDataRepository _heartRateDataRepository;
|
||||
@ -50,7 +50,7 @@ namespace VOL.Ai.Services
|
||||
IS_ClassRepository classRepository,
|
||||
IN_SportsTestCategoryRepository sportsTestCategoryRepository,
|
||||
IN_HealthStandardsRepository healthStandardsRepository,
|
||||
IN_SportsTestResultRepository sportsTestResultRepository,
|
||||
IScanCodeLoginRepository scanCodeLoginRepository,
|
||||
IN_SportsTrainingCategoryRepository sportsTrainingCategoryRepository,
|
||||
IClassRoomRecordRepository classRoomRecordRepository,
|
||||
IHeartRateDataRepository heartRateDataRepository,
|
||||
@ -65,7 +65,7 @@ namespace VOL.Ai.Services
|
||||
_studentRepository = studentRepository;
|
||||
_sportsTestCategoryRepository = sportsTestCategoryRepository;
|
||||
_healthStandardsRepository = healthStandardsRepository;
|
||||
_sportsTestResultRepository = sportsTestResultRepository;
|
||||
_scanCodeLoginRepository = scanCodeLoginRepository;
|
||||
_teacherRepository = teacherRepository;
|
||||
_sportsTrainingCategoryRepository = sportsTrainingCategoryRepository;
|
||||
_classRoomRecordRepository = classRoomRecordRepository;
|
||||
@ -842,7 +842,7 @@ namespace VOL.Ai.Services
|
||||
entity.Year = semesterDto.Year;
|
||||
entity.Semester = semesterDto.Semester;
|
||||
var student = await (from s in _studentRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.StudentNo == paramDto.StudentNo)
|
||||
join c in _studentRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
||||
join c in _classRepository.DbContext.Set<S_Class>() on s.ClassId equals c.Id
|
||||
select new
|
||||
{
|
||||
s.ClassId,
|
||||
@ -1207,12 +1207,11 @@ namespace VOL.Ai.Services
|
||||
/// <returns></returns>
|
||||
public async Task<Ai_TeacherFaceInfo> ScanCodeLogin(Ai_Request paramDto)
|
||||
{
|
||||
var loginInfo = await _teacherRepository.DbContext.Set<Ai_ScanCodeLogin>().Where(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
|
||||
var loginInfo = await _scanCodeLoginRepository.FindAsIQueryable(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
|
||||
|
||||
if (loginInfo == null)
|
||||
return new Ai_TeacherFaceInfo();
|
||||
|
||||
|
||||
var res = await _teacherRepository.FindAsIQueryable(x => x.SchoolCode == paramDto.SchoolCode && x.TeacherStatus != TeacherStatus.Depart && x.TeacherPhoneNo == loginInfo.TeacherPhoneNo && x.Id == loginInfo.TeacherId)
|
||||
.Select(x =>
|
||||
new Ai_TeacherFaceInfo()
|
||||
@ -1251,14 +1250,13 @@ namespace VOL.Ai.Services
|
||||
/// </summary>
|
||||
/// <param name="paramDto"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public async Task<bool> LogOut(LoginOutDto paramDto)
|
||||
{
|
||||
var teacher = await _teacherRepository.DbContext.Set<Ai_ScanCodeLogin>().Where(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
|
||||
var teacher = await _scanCodeLoginRepository.FindAsIQueryable(x => x.Code == paramDto.Code && x.SchoolCode == paramDto.SchoolCode).FirstOrDefaultAsync();
|
||||
|
||||
if (teacher == null) return true;
|
||||
|
||||
_teacherRepository.DbContext.Set<Ai_ScanCodeLogin>().Remove(teacher);
|
||||
_scanCodeLoginRepository.Delete(teacher);
|
||||
return await _teacherRepository.SaveChangesAsync() > 0;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user