Commit b03f9d31 authored by 黄奎's avatar 黄奎

页面修改

parent 35663d95
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Encrypt namespace Edu.Common.Encrypt
{ {
......
...@@ -59,5 +59,10 @@ namespace Edu.Model.ViewModel.User ...@@ -59,5 +59,10 @@ namespace Edu.Model.ViewModel.User
/// 网课订单 /// 网课订单
/// </summary> /// </summary>
public int OnlineOrderCount { get; set; } public int OnlineOrderCount { get; set; }
/// <summary>
/// 助教登录账号
/// </summary>
public string AssistAccount { get; set; }
} }
} }
\ No newline at end of file
...@@ -65,5 +65,10 @@ namespace Edu.Model.ViewModel.User ...@@ -65,5 +65,10 @@ namespace Edu.Model.ViewModel.User
/// 地区名称【省/市/区县】 /// 地区名称【省/市/区县】
/// </summary> /// </summary>
public string AreaName { get; set; } public string AreaName { get; set; }
/// <summary>
/// 学生账号
/// </summary>
public string StudentAccount { get; set; }
} }
} }
\ No newline at end of file
...@@ -59,5 +59,10 @@ namespace Edu.Model.ViewModel.User ...@@ -59,5 +59,10 @@ namespace Edu.Model.ViewModel.User
/// 网课订单 /// 网课订单
/// </summary> /// </summary>
public int OnlineOrderCount { get; set; } public int OnlineOrderCount { get; set; }
/// <summary>
/// 教师账号
/// </summary>
public string TeacherAccount { get; set; }
} }
} }
\ No newline at end of file
...@@ -79,6 +79,28 @@ namespace Edu.Module.User ...@@ -79,6 +79,28 @@ namespace Edu.Module.User
return flag; return flag;
} }
/// <summary>
/// 修改账号状态
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetAccountStatusModule(RB_Account_ViewModel model)
{
bool flag;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Account_ViewModel.Status),(int)model.Status },
{nameof(RB_Account_ViewModel.UpdateTime),model.UpdateTime },
};
List<WhereHelper> list = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId),model.AccountId),
new WhereHelper(nameof(RB_Account_ViewModel.AccountType),(int)model.AccountType),
};
flag = accountRepository.Update(fileds, list);
return flag;
}
/// <summary> /// <summary>
/// 重置密码 /// 重置密码
/// </summary> /// </summary>
...@@ -93,12 +115,13 @@ namespace Edu.Module.User ...@@ -93,12 +115,13 @@ namespace Edu.Module.User
{ {
{nameof(RB_Account_ViewModel.Password), Common.DES.Encrypt(newPwd)} {nameof(RB_Account_ViewModel.Password), Common.DES.Encrypt(newPwd)}
}; };
var wheres = new List<WhereHelper>(); var wheres = new List<WhereHelper>
wheres.Add(new WhereHelper(nameof(RB_Account_ViewModel.AccountId), model.AccountId)); {
wheres.Add(new WhereHelper(nameof(RB_Account_ViewModel.AccountType), model.AccountType)); new WhereHelper(nameof(RB_Account_ViewModel.AccountId), model.AccountId),
wheres.Add(new WhereHelper(nameof(RB_Account_ViewModel.Group_Id), model.Group_Id)); new WhereHelper(nameof(RB_Account_ViewModel.AccountType), model.AccountType),
new WhereHelper(nameof(RB_Account_ViewModel.Group_Id), model.Group_Id)
};
flag = accountRepository.Update(fileds, wheres); flag = accountRepository.Update(fileds, wheres);
return (flag, newPwd); return (flag, newPwd);
} }
} }
......
...@@ -90,7 +90,7 @@ namespace Edu.Module.User ...@@ -90,7 +90,7 @@ namespace Edu.Module.User
/// <returns></returns> /// <returns></returns>
public RB_Assist_ViewModel GetAssistModule(int AId) public RB_Assist_ViewModel GetAssistModule(int AId)
{ {
return GetAssistListModule(new RB_Assist_ViewModel() { AId = AId })?.FirstOrDefault() ?? new RB_Assist_ViewModel(); return assistRepository.GetEntity<RB_Assist_ViewModel>(AId);
} }
/// <summary> /// <summary>
...@@ -98,13 +98,35 @@ namespace Edu.Module.User ...@@ -98,13 +98,35 @@ namespace Edu.Module.User
/// </summary> /// </summary>
/// <param name="AId"></param> /// <param name="AId"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveAssistModule(object AId) [TransactionCallHandler]
public virtual bool RemoveAssistModule(int AId)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() bool flag = false;
var model = GetAssistModule(AId);
if (model != null && model.AId > 0)
{ {
{nameof(RB_Assist.Status),(int)DateStateEnum.Delete }, Dictionary<string, object> fileds = new Dictionary<string, object>()
}; {
bool flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), AId)); {nameof(RB_Assist.Status),(int)DateStateEnum.Delete },
};
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), AId));
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
AccountId=model.AId,
Account = model.AssistTel,
AccountType = AccountTypeEnum.Assist
});
if (accountList != null && accountList.Count > 0)
{
flag = accountModule.SetAccountStatusModule(new RB_Account_ViewModel()
{
AccountType = AccountTypeEnum.Assist,
AccountId = model.AId,
UpdateTime = DateTime.Now,
Status = DateStateEnum.Delete
});
}
}
return flag; return flag;
} }
...@@ -136,7 +158,7 @@ namespace Edu.Module.User ...@@ -136,7 +158,7 @@ namespace Edu.Module.User
{ {
bool flag = false; bool flag = false;
var model = GetAssistModule(AId); var model = GetAssistModule(AId);
if (model != null) if (model != null && model.AId > 0)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
...@@ -147,22 +169,30 @@ namespace Edu.Module.User ...@@ -147,22 +169,30 @@ namespace Edu.Module.User
AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus; AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus;
if (statusEnum == AccountStatusEnum.Pass && flag) if (statusEnum == AccountStatusEnum.Pass && flag)
{ {
flag = accountModule.SetAccountModule(new RB_Account_ViewModel() var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{ {
Account = model.AssistTel, Account = model.AssistTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd), AccountType = AccountTypeEnum.Assist
AccountType = AccountTypeEnum.Assist,
AccountId = model.AId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
}); });
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
Account = model.AssistTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd),
AccountType = AccountTypeEnum.Assist,
AccountId = model.AId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
});
}
} }
} }
return flag; return flag;
} }
} }
} }
\ No newline at end of file
using Edu.Common.Enum; using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Common.Enum.User;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.System; using Edu.Repository.System;
using Edu.Repository.User; using Edu.Repository.User;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using VT.FW.DB; using VT.FW.DB;
...@@ -23,6 +27,11 @@ namespace Edu.Module.User ...@@ -23,6 +27,11 @@ namespace Edu.Module.User
/// </summary> /// </summary>
private readonly RB_DestinationRepository destinationRepository = new RB_DestinationRepository(); private readonly RB_DestinationRepository destinationRepository = new RB_DestinationRepository();
/// <summary>
/// 账号处理类
/// </summary>
private readonly AccountModule accountModule = new AccountModule();
/// <summary> /// <summary>
/// 获取学生列表 /// 获取学生列表
/// </summary> /// </summary>
...@@ -130,14 +139,34 @@ namespace Edu.Module.User ...@@ -130,14 +139,34 @@ namespace Edu.Module.User
/// <param name="StuId"></param> /// <param name="StuId"></param>
/// <param name="Status"></param> /// <param name="Status"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveStudentModule(object StuId,int Status) public bool RemoveStudentModule(int StuId,int Status)
{ {
bool flag; bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>() var model = GetStudentModule(StuId);
if (model != null && model.StuId > 0)
{ {
{nameof(RB_Student_ViewModel.Status), Status}, Dictionary<string, object> fileds = new Dictionary<string, object>()
}; {
flag = studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), StuId)); {nameof(RB_Student_ViewModel.Status), Status},
};
flag = studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), StuId));
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
AccountId = model.StuId,
Account = model.StuTel,
AccountType = AccountTypeEnum.Student
});
if (accountList != null && accountList.Count > 0)
{
flag = accountModule.SetAccountStatusModule(new RB_Account_ViewModel()
{
AccountType = AccountTypeEnum.Student,
AccountId = model.StuId,
UpdateTime = DateTime.Now,
Status = (DateStateEnum)Status
});
}
}
return flag; return flag;
} }
...@@ -157,5 +186,43 @@ namespace Edu.Module.User ...@@ -157,5 +186,43 @@ namespace Edu.Module.User
flag = studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), StuId)); flag = studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), StuId));
return flag; return flag;
} }
/// <summary>
/// 创建学生账号
/// </summary>
/// <param name="StuId"></param>
/// <param name="UserInfo"></param>
/// <returns></returns>
[TransactionCallHandler]
public virtual bool CreateStudentAccountModule(int StuId, UserInfo user)
{
bool flag = false;
var model = GetStudentModule(StuId);
if (model != null && model.StuId > 0)
{
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
Account = model.StuTel,
AccountType = AccountTypeEnum.Student
});
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
Account = model.StuTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd),
AccountType = AccountTypeEnum.Student,
AccountId = model.StuId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
});
}
}
return flag;
}
} }
} }
...@@ -96,7 +96,7 @@ namespace Edu.Module.User ...@@ -96,7 +96,7 @@ namespace Edu.Module.User
/// <returns></returns> /// <returns></returns>
public RB_Teacher_ViewModel GetTeacherModule(int TId) public RB_Teacher_ViewModel GetTeacherModule(int TId)
{ {
return GetTeacherListModule(new RB_Teacher_ViewModel() { TId = TId })?.FirstOrDefault() ?? new RB_Teacher_ViewModel(); return teacherRepository.GetEntity<RB_Teacher_ViewModel>(TId);
} }
/// <summary> /// <summary>
...@@ -104,14 +104,35 @@ namespace Edu.Module.User ...@@ -104,14 +104,35 @@ namespace Edu.Module.User
/// </summary> /// </summary>
/// <param name="TId"></param> /// <param name="TId"></param>
/// <returns></returns> /// <returns></returns>
public bool RemoveTeacherModule(object TId) [TransactionCallHandler]
public virtual bool RemoveTeacherModule(int TId)
{ {
bool flag; bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>() var model = GetTeacherModule(TId);
if (model != null && model.TId > 0)
{ {
{nameof(RB_Teacher_ViewModel.Status),(int)DateStateEnum.Delete }, Dictionary<string, object> fileds = new Dictionary<string, object>()
}; {
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), TId)); {nameof(RB_Teacher_ViewModel.Status),(int)DateStateEnum.Delete },
};
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), TId));
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
AccountId = model.TId,
Account = model.TeacherTel,
AccountType = AccountTypeEnum.Teacher
});
if (accountList != null && accountList.Count > 0)
{
flag = accountModule.SetAccountStatusModule(new RB_Account_ViewModel()
{
AccountType = AccountTypeEnum.Teacher,
AccountId = model.TId,
UpdateTime = DateTime.Now,
Status = DateStateEnum.Delete
});
}
}
return flag; return flag;
} }
...@@ -139,11 +160,11 @@ namespace Edu.Module.User ...@@ -139,11 +160,11 @@ namespace Edu.Module.User
/// <param name="user">用户信息</param> /// <param name="user">用户信息</param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler] [TransactionCallHandler]
public virtual bool AuditTeacherModule(int TId,int AuditStatus,string AuditRemark, UserInfo user) public virtual bool AuditTeacherModule(int TId, int AuditStatus, string AuditRemark, UserInfo user)
{ {
bool flag = false; bool flag = false;
var model = GetTeacherModule(TId); var model = GetTeacherModule(TId);
if (model!=null) if (model != null && model.TId > 0)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
...@@ -151,22 +172,31 @@ namespace Edu.Module.User ...@@ -151,22 +172,31 @@ namespace Edu.Module.User
{nameof(RB_Teacher_ViewModel.AuditRemark),AuditRemark }, {nameof(RB_Teacher_ViewModel.AuditRemark),AuditRemark },
}; };
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), TId)); flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), TId));
AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus; AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus;
if (statusEnum == AccountStatusEnum.Pass && flag) if (statusEnum == AccountStatusEnum.Pass && flag)
{ {
flag = accountModule.SetAccountModule(new RB_Account_ViewModel() var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{ {
Account = model.TeacherTel, Account = model.TeacherTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd), AccountType = AccountTypeEnum.Teacher
AccountType = AccountTypeEnum.Teacher,
AccountId = model.TId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
}); });
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
Account = model.TeacherTel,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd),
AccountType = AccountTypeEnum.Teacher,
AccountId = model.TId,
CreateBy = user.Id,
UpdateBy = user.Id,
CreateTime = DateTime.Now,
UpdateTime = DateTime.Now,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
});
}
} }
} }
return flag; return flag;
......
...@@ -121,6 +121,10 @@ WHERE 1=1 ...@@ -121,6 +121,10 @@ WHERE 1=1
{ {
where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id); where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id);
} }
if (query.AccountId > 0)
{
where.AppendFormat(" AND A.{0}={1} ", nameof(RB_Account_ViewModel.AccountId), query.AccountId);
}
} }
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
......
...@@ -81,9 +81,10 @@ WHERE 1=1 ...@@ -81,9 +81,10 @@ WHERE 1=1
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT a.*,g.GroupName,s.SName SELECT a.*,g.GroupName,s.SName,IFNULL(account.Account,'') AS AssistAccount
FROM rb_assist AS a LEFT JOIN rb_group AS g ON a.Group_Id=g.GId FROM rb_assist AS a LEFT JOIN rb_group AS g ON a.Group_Id=g.GId
LEFT JOIN rb_school AS s ON a.School_Id=s.SId LEFT JOIN rb_school AS s ON a.School_Id=s.SId
LEFT JOIN rb_account as account ON (a.AId=account.AccountId AND account.AccountType=3 )
WHERE 1=1 WHERE 1=1
"); ");
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Assist_ViewModel.Status), (int)DateStateEnum.Normal); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Assist_ViewModel.Status), (int)DateStateEnum.Normal);
......
...@@ -77,9 +77,10 @@ WHERE 1=1 ...@@ -77,9 +77,10 @@ WHERE 1=1
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT t.*,g.GroupName,s.SName SELECT t.*,g.GroupName,s.SName,IFNULL(a.Account,'') AS StudentAccount
FROM rb_student AS t LEFT JOIN rb_group AS g ON t.Group_Id=g.GId FROM rb_student AS t LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
LEFT JOIN rb_school AS s ON t.School_Id=s.SId LEFT JOIN rb_school AS s ON t.School_Id=s.SId
LEFT JOIN rb_account as a ON (t.StuId=a.AccountId AND a.AccountType=4 )
WHERE 1=1 WHERE 1=1
"); ");
if (query != null) if (query != null)
......
...@@ -87,9 +87,10 @@ WHERE 1=1 ...@@ -87,9 +87,10 @@ WHERE 1=1
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT t.*,g.GroupName,s.SName SELECT t.*,g.GroupName,s.SName,IFNULL(a.Account,'') AS TeacherAccount
FROM rb_teacher AS t LEFT JOIN rb_group AS g ON t.Group_Id=g.GId FROM rb_teacher AS t LEFT JOIN rb_group AS g ON t.Group_Id=g.GId
LEFT JOIN rb_school AS s ON t.School_Id=s.SId LEFT JOIN rb_school AS s ON t.School_Id=s.SId
LEFT JOIN rb_account as a ON (t.TId=a.AccountId AND a.AccountType=2)
WHERE 1=1 WHERE 1=1
"); ");
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.Status), (int)DateStateEnum.Normal); builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.Status), (int)DateStateEnum.Normal);
......
...@@ -70,7 +70,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -70,7 +70,7 @@ namespace Edu.WebApi.Controllers.User
} }
if (model.Status == Common.Enum.DateStateEnum.Delete) if (model.Status == Common.Enum.DateStateEnum.Delete)
{ {
return ApiResult.Failed(message: $"此账号【{ account }】已删除!"); return ApiResult.Failed(message: $"此账号【{ account }】已禁用,如需使用请联系管理员!");
} }
//生成token //生成token
string token = WebApiTokenHelper.CreateToken(model.Id.ToString(), Common.Enum.ApiRequestFromEnum.WebAdmin); string token = WebApiTokenHelper.CreateToken(model.Id.ToString(), Common.Enum.ApiRequestFromEnum.WebAdmin);
...@@ -132,7 +132,5 @@ namespace Edu.WebApi.Controllers.User ...@@ -132,7 +132,5 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
} }
} }
\ No newline at end of file
...@@ -583,6 +583,18 @@ namespace Edu.WebApi.Controllers.User ...@@ -583,6 +583,18 @@ namespace Edu.WebApi.Controllers.User
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 生成学生账号
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult CreateStudentAccount()
{
var StuId = base.ParmJObj.GetInt("StuId", 0);
var flag = studentModule.CreateStudentAccountModule(StuId,base.UserInfo);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
#endregion #endregion
#region 管理者管理 #region 管理者管理
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment