Commit bf5fbddd authored by 黄奎's avatar 黄奎

同步学生账号修改

parent 92cc6561
......@@ -20,6 +20,13 @@ namespace EduSpider.Repository
int GetMaxStuTeaId(int type);
/// <summary>
/// 获取账号信息
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public List<rb_account_hk_Extend> GetStuAccountList(int type, string Account);
public List<rb_account_hk_Extend> GetAccountList(rb_account_hk_Extend demodel);
/// <summary>
......
......@@ -85,6 +85,17 @@ INNER JOIN rb_student_hk s on a.Id =s.StudId and a.AccountType =2
return obj == null ? 0 : Convert.ToInt32(obj);
}
/// <summary>
/// 获取账号信息
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public List<rb_account_hk_Extend> GetStuAccountList(int type,string Account)
{
string sql = $" select * from rb_account_hk where AccountType ={type} and Account IN({Account})";
return Get<rb_account_hk_Extend>(sql).ToList();
}
/// <summary>
/// 获取教师信息
/// </summary>
......
......@@ -61,6 +61,7 @@ namespace EduSpider.Spiders.ClassInRule
#region 组装实体
var stus = new List<rb_student_hk>();
var stuArray = (data["studentList"] as JArray);
string accountIds = "";
foreach (JObject x in stuArray)
{
var xModel = new rb_student_hk()
......@@ -85,6 +86,7 @@ namespace EduSpider.Spiders.ClassInRule
xModel.StudentAccount = mobile;
}
}
accountIds += string.Format(",'{0}'", xModel.StudentAccount);
stus.Add(xModel);
}
courseRepository.BatchSetStudent(stus);
......@@ -93,13 +95,15 @@ namespace EduSpider.Spiders.ClassInRule
#endregion
#region 写入账号
if (stus.Any(x => x.StudId > MaxStuId))
if (stus.Any())
{
foreach (var item in stus.Where(x => x.StudId > MaxStuId))
var stuAccountList = accountRepository.GetStuAccountList(1, accountIds.TrimStart(','));
foreach (var item in stus)
{
var tempAccount = stuAccountList?.FirstOrDefault(qitem => qitem.Id == item.StudId && qitem.Account == item.StudentAccount && qitem.AccountId == item.StudentUid);
accountList.Add(new rb_account_hk()
{
UniqueId = 0,
UniqueId = tempAccount?.UniqueId ?? 0,
Id = item.StudId,
Account = item.StudentAccount,
AccountId = item.StudentUid,
......
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