Commit b03f9d31 authored by 黄奎's avatar 黄奎

页面修改

parent 35663d95
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Common.Encrypt
{
......
......@@ -59,5 +59,10 @@ namespace Edu.Model.ViewModel.User
/// 网课订单
/// </summary>
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
/// 地区名称【省/市/区县】
/// </summary>
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
/// 网课订单
/// </summary>
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
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>
......@@ -93,12 +115,13 @@ namespace Edu.Module.User
{
{nameof(RB_Account_ViewModel.Password), Common.DES.Encrypt(newPwd)}
};
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));
wheres.Add(new WhereHelper(nameof(RB_Account_ViewModel.Group_Id), model.Group_Id));
var wheres = new List<WhereHelper>
{
new WhereHelper(nameof(RB_Account_ViewModel.AccountId), model.AccountId),
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);
return (flag, newPwd);
}
}
......
......@@ -90,7 +90,7 @@ namespace Edu.Module.User
/// <returns></returns>
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>
......@@ -98,13 +98,35 @@ namespace Edu.Module.User
/// </summary>
/// <param name="AId"></param>
/// <returns></returns>
public bool RemoveAssistModule(object AId)
[TransactionCallHandler]
public virtual bool RemoveAssistModule(int AId)
{
bool flag = false;
var model = GetAssistModule(AId);
if (model != null && model.AId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Assist.Status),(int)DateStateEnum.Delete },
};
bool flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), AId));
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;
}
......@@ -136,7 +158,7 @@ namespace Edu.Module.User
{
bool flag = false;
var model = GetAssistModule(AId);
if (model != null)
if (model != null && model.AId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
......@@ -146,6 +168,13 @@ namespace Edu.Module.User
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist_ViewModel.AId), AId));
AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus;
if (statusEnum == AccountStatusEnum.Pass && flag)
{
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
Account = model.AssistTel,
AccountType = AccountTypeEnum.Assist
});
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
......@@ -162,6 +191,7 @@ namespace Edu.Module.User
});
}
}
}
return flag;
}
}
......
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.Repository.System;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
using System.Linq;
using VT.FW.DB;
......@@ -23,6 +27,11 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_DestinationRepository destinationRepository = new RB_DestinationRepository();
/// <summary>
/// 账号处理类
/// </summary>
private readonly AccountModule accountModule = new AccountModule();
/// <summary>
/// 获取学生列表
/// </summary>
......@@ -130,14 +139,34 @@ namespace Edu.Module.User
/// <param name="StuId"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveStudentModule(object StuId,int Status)
public bool RemoveStudentModule(int StuId,int Status)
{
bool flag = false;
var model = GetStudentModule(StuId);
if (model != null && model.StuId > 0)
{
bool flag;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{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;
}
......@@ -157,5 +186,43 @@ namespace Edu.Module.User
flag = studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), StuId));
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
/// <returns></returns>
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>
......@@ -104,14 +104,35 @@ namespace Edu.Module.User
/// </summary>
/// <param name="TId"></param>
/// <returns></returns>
public bool RemoveTeacherModule(object TId)
[TransactionCallHandler]
public virtual bool RemoveTeacherModule(int TId)
{
bool flag = false;
var model = GetTeacherModule(TId);
if (model != null && model.TId > 0)
{
bool flag;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{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;
}
......@@ -139,11 +160,11 @@ namespace Edu.Module.User
/// <param name="user">用户信息</param>
/// <returns></returns>
[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;
var model = GetTeacherModule(TId);
if (model!=null)
if (model != null && model.TId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
......@@ -151,8 +172,16 @@ namespace Edu.Module.User
{nameof(RB_Teacher_ViewModel.AuditRemark),AuditRemark },
};
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), TId));
AccountStatusEnum statusEnum = (AccountStatusEnum)AuditStatus;
if (statusEnum == AccountStatusEnum.Pass && flag)
{
var accountList = accountModule.GetAccountListExtModule(new RB_Account_ViewModel()
{
Account = model.TeacherTel,
AccountType = AccountTypeEnum.Teacher
});
if (accountList == null || (accountList != null && accountList.Count == 0))
{
flag = accountModule.SetAccountModule(new RB_Account_ViewModel()
{
......@@ -169,6 +198,7 @@ namespace Edu.Module.User
});
}
}
}
return flag;
}
}
......
......@@ -121,6 +121,10 @@ WHERE 1=1
{
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();
......
......@@ -81,9 +81,10 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
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
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
");
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Assist_ViewModel.Status), (int)DateStateEnum.Normal);
......
......@@ -77,9 +77,10 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
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
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
");
if (query != null)
......
......@@ -87,9 +87,10 @@ WHERE 1=1
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
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
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
");
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.Status), (int)DateStateEnum.Normal);
......
......@@ -70,7 +70,7 @@ namespace Edu.WebApi.Controllers.User
}
if (model.Status == Common.Enum.DateStateEnum.Delete)
{
return ApiResult.Failed(message: $"此账号【{ account }】已删除!");
return ApiResult.Failed(message: $"此账号【{ account }】已禁用,如需使用请联系管理员!");
}
//生成token
string token = WebApiTokenHelper.CreateToken(model.Id.ToString(), Common.Enum.ApiRequestFromEnum.WebAdmin);
......@@ -132,7 +132,5 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Failed();
}
}
}
}
\ No newline at end of file
......@@ -583,6 +583,18 @@ namespace Edu.WebApi.Controllers.User
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
#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