Commit 7889007a authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents cbd4171f 5c894047
......@@ -2406,59 +2406,19 @@ namespace Edu.Module.Course
}
#region 新增修改学员账号
if (flag)
if (flag &&!string.IsNullOrEmpty(dmodel.Mobile))
{
//检查【学员表(rb_order_guest)和学生表(rb_student)】关联信息
var stuOrderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel { ClassId = ordermodel.ClassId, OrderId = ordermodel.OrderId, GuestId = dmodel.Id }).FirstOrDefault();
//学员账号信息
var accmodel = accountRepository.GetAccountListRepository(new RB_Account_ViewModel() { Group_Id = dmodel.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Student, Account = dmodel.Mobile }).FirstOrDefault();
//【学员表、学生表、账号表】关联表和账号信息都存在
if (stuOrderGuestModel != null && accmodel != null)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Student_ViewModel.StuIcon),dmodel.StuIcon},
{nameof(RB_Student_ViewModel.StuTel),dmodel.Mobile},
{nameof(RB_Student_ViewModel.StuName),dmodel.GuestName},
{nameof(RB_Student_ViewModel.StuSex), dmodel.Sex - 1},
{nameof(RB_Student_ViewModel.StuBirth),dmodel.BirthDate},
};
studentRepository.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), stuOrderGuestModel.Student_Id));
}
//有【学员表、学生表、账号表】关联信息,没有账号信息【需要修改账号表中的账号】
else if (stuOrderGuestModel != null && accmodel == null)
//学员表
var stuModel = studentRepository.GetStuByTelRepository(new RB_Student_ViewModel()
{
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{nameof(RB_Account_ViewModel.Account),dmodel.Mobile }
};
accountRepository.Update(accountFileds, new WhereHelper(nameof(RB_Account_ViewModel.Id), stuOrderGuestModel.Account_Id));
}
//有【账号】信息,没有关联信息
else if (stuOrderGuestModel == null && accmodel != null)
{
//创建学员表、学生表、账号表关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{
Id = 0,
Account_Id = accmodel.Id,
ClassId = ordermodel.ClassId,
CreateBy = dmodel.CreateBy,
CreateTime = DateTime.Now,
GuestId = dmodel.Id,
OrderId = dmodel.OrderId,
Status = DateStateEnum.Normal,
Student_Id = accmodel.AccountId
});
LogContent += ",添加学生账号关联【" + accmodel.Id + "】";
}
//关联信息和账号都不存在
else
Group_Id = dmodel.Group_Id,
StuTel = dmodel.Mobile
});
//不存在存在学员基本信息
if (stuModel == null)
{
//创建学生表信息
var stuModel = new RB_Student_ViewModel()
stuModel = new RB_Student_ViewModel()
{
StuId = 0,
AreaId = 0,
......@@ -2482,7 +2442,18 @@ namespace Edu.Module.Course
CreateType = Common.Enum.User.StuCreateTypeEnum.EmployeeInput
};
studentRepository.SetStudentRepository(stuModel);
}
//检查【学员表(rb_order_guest)和学生表(rb_student)】关联信息
var stuOrderGuestModel = student_OrderGuestRepository.GetStrOrderGuestListRepository(new RB_Student_OrderGuest_ViewModel
{
ClassId = ordermodel.ClassId,
OrderId = ordermodel.OrderId,
GuestId = dmodel.Id
}).FirstOrDefault();
//不存在学员表、学生表、账号表】关联信息
if (stuOrderGuestModel == null)
{
//创建【学员表、学生表、账号表】关联信息
student_OrderGuestRepository.Insert(new Model.Entity.User.RB_Student_OrderGuest()
{
......
using Edu.Common.Enum;
using Edu.Common.Plugin;
using Edu.Model.Entity.User;
using Edu.Model.ViewModel.User;
using Edu.Repository.Customer;
using Edu.Repository.System;
......@@ -423,7 +424,6 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
{
{nameof(RB_Student_ViewModel.StuName),model.StuName.Trim() },
{nameof(RB_Student_ViewModel.StuTel),model.StuTel.Trim() },
{nameof(RB_Student_ViewModel.StuIcon),model.StuIcon.Trim() },
{nameof(RB_Student_ViewModel.StuSex),model.StuSex },
{nameof(RB_Student_ViewModel.StuBirth),model.StuBirth },
{nameof(RB_Student_ViewModel.ProviceId),model.ProviceId },
......@@ -456,6 +456,7 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
fileds.Add(nameof(RB_Student_ViewModel.StuContractMobile), model.StuContractMobile);
fileds.Add(nameof(RB_Student_ViewModel.StuIDCard), model.StuIDCard);
fileds.Add(nameof(RB_Student_ViewModel.StuIDCardAddress), model.StuIDCardAddress);
fileds.Add(nameof(RB_Student_ViewModel.StuIcon), model.StuIcon.Trim());
}
flag = base.Update(fileds, new WhereHelper(nameof(RB_Student_ViewModel.StuId), model.StuId));
createBy = model.UpdateBy;
......@@ -469,9 +470,25 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
var newId = base.Insert(model);
model.StuId = newId;
flag = newId > 0;
if (model.CreateType == Common.Enum.User.StuCreateTypeEnum.EmployeeInput)
{
createBy = model.CreateBy;
}
else
{
createBy = model.CustomerId;
}
logContent = "创建了该客户";
logTitle = "创建客户";
}
#region 处理学员账号信息
var accountModel= accountRepository.GetAccountListRepository(new RB_Account_ViewModel() { Group_Id = model.Group_Id, AccountType = Common.Enum.User.AccountTypeEnum.Student, AccountId = model.StuId }).FirstOrDefault();
if (accountModel == null)
{
//创建学生账号
model.Account_Id = accountRepository.Insert(new Model.Entity.User.RB_Account()
model.Account_Id = accountRepository.Insert(new RB_Account()
{
Id = 0,
Account = model.StuTel,
......@@ -487,18 +504,21 @@ WHERE o.OrderState=1 and og.`Status`=0 and sog.`Status`=0 and og.GuestState=1 an
UpdateTime = DateTime.Now,
Password = Common.DES.Encrypt(Common.Config.DefaultPwd)
});
if (model.CreateType == Common.Enum.User.StuCreateTypeEnum.EmployeeInput)
{
createBy = model.CreateBy;
}
else
}
else
{
if (model.StuTel != accountModel.Account)
{
createBy = model.CustomerId;
Dictionary<string, object> accountFileds = new Dictionary<string, object>()
{
{nameof(RB_Account.Account),model.StuTel}
};
accountRepository.Update(accountFileds, new WhereHelper(nameof(RB_Account.Id), accountModel.Id));
}
logContent = "创建了该客户";
logTitle = "创建客户";
}
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, createBy, CreateType: (int)model.CreateType);
#endregion
student_LogRepository.AddStuLogRepository(model.StuId, Common.Enum.Log.StudentLogTypeEnum.BasicInfo, logTitle, logContent, createBy, CreateType: model.OperateType);
return flag;
}
......@@ -612,8 +632,8 @@ WHERE 1=1 AND YEARWEEK(date_format(t.CreateTime, '%Y-%m-%d')) = YEARWEEK(now())
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT t.*
FROM rb_student AS t
SELECT t.*,B.Id AS Account_Id
FROM rb_student AS t LEFT JOIN rb_account AS B ON t.StuId=B.AccountId AND B.AccountType=4
WHERE 1=1
");
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Student_ViewModel.Status), (int)DateStateEnum.Normal);
......
......@@ -343,7 +343,15 @@ namespace Edu.WebApi.Controllers.Customer
foreach (var item in data)
{
string CreateByName = "";
CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
if (item.CreateBy == 1)
{
CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "";
}
else
{
CreateByName = UserReidsCache.GetAppletCustomerLoginInfo(item.CreateBy)?.CustomerName ?? "";
}
list.Add(new
{
item.LogId,
......
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