Commit 5f820cdf authored by 吴春's avatar 吴春

提交员工管理

parent 88bfde8e
...@@ -69,6 +69,33 @@ namespace Edu.Model.ViewModel.User ...@@ -69,6 +69,33 @@ namespace Edu.Model.ViewModel.User
/// 员工编号【查询使用,逗号分隔】 /// 员工编号【查询使用,逗号分隔】
/// </summary> /// </summary>
public string QIds { get; set; } public string QIds { get; set; }
/// <summary>
/// 入职开始时间【查询使用】
/// </summary>
public string StartEntryTime { get; set; }
/// <summary>
/// 离职开始时间【查询使用】
/// </summary>
public string EndEntryTime { get; set; }
/// <summary>
/// 离职开始时间【查询使用】
/// </summary>
public string StartLeaveTime { get; set; }
/// <summary>
/// 离职结束时间【查询使用】
/// </summary>
public string EndLeaveTime { get; set; }
/// <summary>
/// 生日开始时间【查询使用,2020-01】
/// </summary>
public string StartBirthDate { get; set; }
/// <summary>
/// 生日结束时间【查询使用,2020-01】
/// </summary>
public string EndBirthDate { get; set; }
/// <summary> /// <summary>
/// 部门层级 /// 部门层级
......
...@@ -50,6 +50,11 @@ namespace Edu.Model.ViewModel.User ...@@ -50,6 +50,11 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public string PostName { get; set; } public string PostName { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary> /// <summary>
/// 用户类型(1-管理端,2-讲师,3-助教) /// 用户类型(1-管理端,2-讲师,3-助教)
/// </summary> /// </summary>
......
using Edu.Common.Encrypt; using Edu.AOP.CustomerAttribute;
using Edu.Common.Encrypt;
using Edu.Model.ViewModel.User; using Edu.Model.ViewModel.User;
using Edu.Repository.User; using Edu.Repository.User;
using System; using System;
...@@ -106,7 +107,7 @@ namespace Edu.Module.User ...@@ -106,7 +107,7 @@ namespace Edu.Module.User
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
public (bool reuslt,string newPass) SetResetPassword(RB_Account_ViewModel model) public (bool reuslt, string newPass) SetResetPassword(RB_Account_ViewModel model)
{ {
bool flag; bool flag;
//生成随机新密码 //生成随机新密码
...@@ -124,5 +125,35 @@ namespace Edu.Module.User ...@@ -124,5 +125,35 @@ namespace Edu.Module.User
flag = accountRepository.Update(fileds, wheres); flag = accountRepository.Update(fileds, wheres);
return (flag, newPwd); return (flag, newPwd);
} }
/// <summary>
/// 重置密码
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[TransactionCallHandler]
public bool SetBatchResetPassword(List<RB_Account_ViewModel> list, string newPwd)
{
bool flag=false;
foreach (var model in list)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Account_ViewModel.Password), Common.DES.Encrypt(newPwd)}
};
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;
}
} }
} }
\ No newline at end of file
...@@ -103,31 +103,23 @@ namespace Edu.Module.User ...@@ -103,31 +103,23 @@ namespace Edu.Module.User
var oldModel = GetAssistModule(model.AId); var oldModel = GetAssistModule(model.AId);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Assist.School_Id),model.School_Id }, {nameof(RB_Assist.School_Id),model.School_Id },
{nameof(RB_Assist.Teacher_Id),model.Teacher_Id },
{nameof(RB_Assist.AssistName),model.AssistName.Trim() }, {nameof(RB_Assist.AssistName),model.AssistName.Trim() },
{nameof(RB_Assist.AssistTel),model.AssistTel }, {nameof(RB_Assist.AssistTel),model.AssistTel },
{nameof(RB_Assist.AssistIcon),model.AssistIcon },
{nameof(RB_Assist.AssistIntro),model.AssistIntro },
{nameof(RB_Assist.UpdateBy),model.UpdateBy }, {nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime }, {nameof(RB_Assist.UpdateTime),model.UpdateTime },
{nameof(RB_Assist.Dept_Id),model.Dept_Id }, { nameof(RB_Assist.IDCard),model.IDCard },
{nameof(RB_Assist.Post_Id),model.Post_Id }, { nameof(RB_Assist.Sex),model.Sex },
{ nameof(RB_Assist.EntryTime),model.EntryTime },
{ nameof(RB_Assist.Address),model.Address },
{ nameof(RB_Assist.BirthDate),model.BirthDate },
{ nameof(RB_Assist.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Assist.Education),model.Education },
}; };
if (isUpdateBasic)
{
fileds.Add(nameof(RB_Assist.AssistIcon), model.AssistIcon);
fileds.Add(nameof(RB_Assist.AssistIntro), model.AssistIntro);
fileds.Add(nameof(RB_Assist.Teacher_Id), model.Teacher_Id);
}
else
{
fileds.Add(nameof(RB_Assist.IDCard), model.IDCard);
fileds.Add(nameof(RB_Assist.Sex), model.Sex);
fileds.Add(nameof(RB_Assist.EntryTime), model.EntryTime);
fileds.Add(nameof(RB_Assist.Address), model.Address);
fileds.Add(nameof(RB_Assist.BirthDate), model.BirthDate);
fileds.Add(nameof(RB_Assist.LeaveStatus), model.LeaveStatus);
fileds.Add(nameof(RB_Assist.LeaveTime), model.LeaveTime);
fileds.Add(nameof(RB_Assist.Education), model.Education);
}
string logContent = ""; string logContent = "";
if (model.AssistName != oldModel.AssistName) if (model.AssistName != oldModel.AssistName)
{ {
...@@ -137,15 +129,13 @@ namespace Edu.Module.User ...@@ -137,15 +129,13 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.AssistTel, oldModel.AssistTel); logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.AssistTel, oldModel.AssistTel);
} }
if (model.Dept_Id != oldModel.Dept_Id) if (model.AssistIntro != oldModel.AssistIntro)
{ {
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id }); logContent += string.Format(",将简介由【{0}】修改为【{1}】。", oldModel.AssistIntro, oldModel.AssistIntro);
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
} }
if (model.Post_Id != oldModel.Post_Id) if (model.AssistIcon != oldModel.AssistIcon)
{ {
var postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = model.Post_Id + "," + oldModel.Post_Id }); logContent += string.Format(",将头像由【{0}】修改为【{1}】。", oldModel.AssistIcon, oldModel.AssistIcon);
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
} }
if (model.IDCard != oldModel.IDCard) if (model.IDCard != oldModel.IDCard)
{ {
...@@ -157,7 +147,7 @@ namespace Edu.Module.User ...@@ -157,7 +147,7 @@ namespace Edu.Module.User
} }
if (Common.ConvertHelper.FormatDate(model.EntryTime) != Common.ConvertHelper.FormatDate(oldModel.EntryTime)) if (Common.ConvertHelper.FormatDate(model.EntryTime) != Common.ConvertHelper.FormatDate(oldModel.EntryTime))
{ {
logContent += string.Format(",将入职时间由【{0}】修改为【{1}】。", oldModel.EntryTime, model.EntryTime); logContent += string.Format(",将入职时间由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.EntryTime), Common.ConvertHelper.FormatDate(model.EntryTime));
} }
if (model.Address != oldModel.Address) if (model.Address != oldModel.Address)
{ {
...@@ -167,6 +157,142 @@ namespace Edu.Module.User ...@@ -167,6 +157,142 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
} }
if (model.Education != oldModel.Education)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
}
else
{
var newId = assistRepository.Insert(model);
model.AId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 添加修改助教部门
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetAssistDeptModule(RB_Assist model, bool isUpdateBasic = false)
{
bool flag;
if (model.AId > 0)
{
var oldModel = GetAssistModule(model.AId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime },
{nameof(RB_Assist.Dept_Id),model.Dept_Id },
// {nameof(RB_Assist.Post_Id),model.Post_Id },
};
string logContent = "";
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
}
else
{
var newId = assistRepository.Insert(model);
model.AId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 添加修改助教岗位
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetAssistPostModule(RB_Assist model, bool isUpdateBasic = false)
{
bool flag;
if (model.AId > 0)
{
var oldModel = GetAssistModule(model.AId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime },
{nameof(RB_Assist.Post_Id),model.Post_Id },
};
string logContent = "";
if (model.Post_Id != oldModel.Post_Id)
{
var postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = model.Post_Id + "," + oldModel.Post_Id });
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = assistRepository.Update(fileds, new WhereHelper(nameof(RB_Assist.AId), model.AId));
}
else
{
var newId = assistRepository.Insert(model);
model.AId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 添加修改助教离职时间
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetAssistLeaveTimeModule(RB_Assist model, bool isUpdateBasic = false)
{
bool flag;
if (model.AId > 0)
{
var oldModel = GetAssistModule(model.AId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Assist.LeaveStatus),model.LeaveStatus },
{nameof(RB_Assist.LeaveTime),model.LeaveTime },
{nameof(RB_Assist.UpdateBy),model.UpdateBy },
{nameof(RB_Assist.UpdateTime),model.UpdateTime },
};
string logContent = "";
if (model.LeaveStatus != oldModel.LeaveStatus) if (model.LeaveStatus != oldModel.LeaveStatus)
{ {
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName()); logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
...@@ -175,10 +301,7 @@ namespace Edu.Module.User ...@@ -175,10 +301,7 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime); logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
} }
if (model.Education != oldModel.Education)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
}
if (!string.IsNullOrEmpty(logContent)) if (!string.IsNullOrEmpty(logContent))
{ {
//新增日志 //新增日志
...@@ -195,6 +318,7 @@ namespace Edu.Module.User ...@@ -195,6 +318,7 @@ namespace Edu.Module.User
return flag; return flag;
} }
/// <summary> /// <summary>
/// 根据编号获取助教实体 /// 根据编号获取助教实体
/// </summary> /// </summary>
......
...@@ -157,27 +157,27 @@ namespace Edu.Module.User ...@@ -157,27 +157,27 @@ namespace Edu.Module.User
case Common.Enum.User.AccountTypeEnum.Teacher: case Common.Enum.User.AccountTypeEnum.Teacher:
flag = teacherModule.SetTeacherModule(new RB_Teacher_ViewModel() flag = teacherModule.SetTeacherModule(new RB_Teacher_ViewModel()
{ {
TId=extModel.AccountId, TId = extModel.AccountId,
School_Id=extModel.School_Id, School_Id = extModel.School_Id,
TeacherName=extModel.EmployeeName, TeacherName = extModel.EmployeeName,
TeacherTel=extModel.EmployeeTel, TeacherTel = extModel.EmployeeTel,
TeacherHead=extModel.UserIcon, TeacherHead = extModel.UserIcon,
Status=extModel.Status, Status = extModel.Status,
CreateBy=extModel.CreateBy, CreateBy = extModel.CreateBy,
CreateTime=extModel.CreateTime, CreateTime = extModel.CreateTime,
UpdateBy=extModel.UpdateBy, UpdateBy = extModel.UpdateBy,
UpdateTime=extModel.UpdateTime, UpdateTime = extModel.UpdateTime,
Group_Id=extModel.Group_Id, Group_Id = extModel.Group_Id,
Dept_Id=extModel.Dept_Id, Dept_Id = extModel.Dept_Id,
Post_Id=extModel.Post_Id, Post_Id = extModel.Post_Id,
IDCard=extModel.IDCard, IDCard = extModel.IDCard,
Sex=extModel.Sex, Sex = extModel.Sex,
EntryTime=extModel.EntryTime, EntryTime = extModel.EntryTime,
Address = extModel.Address, Address = extModel.Address,
BirthDate=extModel.BirthDate, BirthDate = extModel.BirthDate,
LeaveStatus=extModel.LeaveStatus, LeaveStatus = extModel.LeaveStatus,
LeaveTime=extModel.LeaveTime, LeaveTime = extModel.LeaveTime,
Education=extModel.Education, Education = extModel.Education,
}); });
break; break;
case Common.Enum.User.AccountTypeEnum.Assist: case Common.Enum.User.AccountTypeEnum.Assist:
...@@ -208,5 +208,215 @@ namespace Edu.Module.User ...@@ -208,5 +208,215 @@ namespace Edu.Module.User
} }
return flag; return flag;
} }
public virtual bool ExistPhone(Employee_ViewModel extModel)
{
bool flag = false;
switch (extModel.AccountType)
{
case Common.Enum.User.AccountTypeEnum.Admin:
var list = managerModule.GetManagerListModule(new RB_Manager_ViewModel { Group_Id = extModel.Group_Id, MTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = list.Count() > 0 ? true : false;
}
else
{
flag = list.Where(x => x.MId != extModel.AccountId).Count() > 0 ? true : false;
}
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
var teacherList = teacherModule.GetTeacherListModule(new RB_Teacher_ViewModel { Group_Id = extModel.Group_Id, TeacherTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = teacherList.Count() > 0 ? true : false;
}
else
{
flag = teacherList.Where(x => x.TId != extModel.AccountId).Count() > 0 ? true : false;
}
break;
case Common.Enum.User.AccountTypeEnum.Assist:
var assistList = assistModule.GetAssistListModule(new RB_Assist_ViewModel { Group_Id = extModel.Group_Id, AssistTel = extModel.EmployeeTel });
if (extModel.AccountId == 0)
{
flag = assistList.Count() > 0 ? true : false;
}
else
{
flag = assistList.Where(x => x.AId != extModel.AccountId).Count() > 0 ? true : false;
}
break;
}
return flag;
}
/// <summary>
/// 新增修改员工部门信息
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public virtual bool SetEmployeeDeptModule(Employee_ViewModel extModel)
{
bool flag = false;
switch (extModel.AccountType)
{
case Common.Enum.User.AccountTypeEnum.Admin:
flag = managerModule.SetManagerDeptModule(new RB_Manager_ViewModel()
{
MId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
flag = teacherModule.SetTeacherDeptModule(new RB_Teacher_ViewModel()
{
TId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
case Common.Enum.User.AccountTypeEnum.Assist:
flag = assistModule.SetAssistDeptModule(new Model.Entity.User.RB_Assist()
{
AId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Dept_Id = extModel.Dept_Id
});
break;
}
return flag;
}
/// <summary>
/// 新增修改员工岗位信息
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public virtual bool SetEmployeePostModule(Employee_ViewModel extModel)
{
bool flag = false;
switch (extModel.AccountType)
{
case Common.Enum.User.AccountTypeEnum.Admin:
flag = managerModule.SetManagerPostModule(new RB_Manager_ViewModel()
{
MId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id,
});
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
flag = teacherModule.SetTeacherPostModule(new RB_Teacher_ViewModel()
{
TId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id,
});
break;
case Common.Enum.User.AccountTypeEnum.Assist:
flag = assistModule.SetAssistPostModule(new Model.Entity.User.RB_Assist()
{
AId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id,
});
break;
}
return flag;
}
/// <summary>
/// 新增修改员工离职信息
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public virtual bool SetEmployeeLeaveTimeModule(List<Employee_ViewModel> List)
{
bool flag = false;
foreach (var extModel in List)
{
switch (extModel.AccountType)
{
case Common.Enum.User.AccountTypeEnum.Admin:
flag = managerModule.SetManagerLeaveTimeModule(new RB_Manager_ViewModel()
{
MId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
LeaveStatus = extModel.LeaveStatus,
LeaveTime = extModel.LeaveTime,
});
break;
case Common.Enum.User.AccountTypeEnum.Teacher:
flag = teacherModule.SetTeacherLeaveTimeModule(new RB_Teacher_ViewModel()
{
TId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
LeaveStatus = extModel.LeaveStatus,
LeaveTime = extModel.LeaveTime
});
break;
case Common.Enum.User.AccountTypeEnum.Assist:
flag = assistModule.SetAssistLeaveTimeModule(new Model.Entity.User.RB_Assist()
{
AId = extModel.AccountId,
CreateBy = extModel.CreateBy,
Group_Id = extModel.Group_Id,
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
LeaveStatus = extModel.LeaveStatus,
LeaveTime = extModel.LeaveTime
});
break;
}
}
return flag;
}
} }
} }
\ No newline at end of file
...@@ -58,6 +58,7 @@ namespace Edu.Module.User ...@@ -58,6 +58,7 @@ namespace Edu.Module.User
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
/// <returns></returns> /// <returns></returns>
[TransactionCallHandler]
public bool SetManagerModule(RB_Manager_ViewModel model) public bool SetManagerModule(RB_Manager_ViewModel model)
{ {
bool flag; bool flag;
...@@ -71,15 +72,12 @@ namespace Edu.Module.User ...@@ -71,15 +72,12 @@ namespace Edu.Module.User
{ nameof(RB_Manager_ViewModel.MHead),model.MHead }, { nameof(RB_Manager_ViewModel.MHead),model.MHead },
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy }, { nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime }, { nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id },
{ nameof(RB_Manager_ViewModel.Post_Id),model.Post_Id },
{ nameof(RB_Manager_ViewModel.IDCard),model.IDCard }, { nameof(RB_Manager_ViewModel.IDCard),model.IDCard },
{ nameof(RB_Manager_ViewModel.Sex),model.Sex }, { nameof(RB_Manager_ViewModel.Sex),model.Sex },
{ nameof(RB_Manager_ViewModel.EntryTime),model.EntryTime }, { nameof(RB_Manager_ViewModel.EntryTime),model.EntryTime },
{ nameof(RB_Manager_ViewModel.Address),model.Address }, { nameof(RB_Manager_ViewModel.Address),model.Address },
{ nameof(RB_Manager_ViewModel.BirthDate),model.BirthDate }, { nameof(RB_Manager_ViewModel.BirthDate),model.BirthDate },
{ nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus }, { nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Manager_ViewModel.LeaveTime),model.LeaveTime },
{ nameof(RB_Manager_ViewModel.Education),model.Education }, { nameof(RB_Manager_ViewModel.Education),model.Education },
}; };
string logContent = ""; string logContent = "";
...@@ -91,16 +89,26 @@ namespace Edu.Module.User ...@@ -91,16 +89,26 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.MTel, oldModel.MTel); logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.MTel, oldModel.MTel);
} }
if (model.Dept_Id != oldModel.Dept_Id) #region 注释
{ //if (model.Dept_Id != oldModel.Dept_Id)
var deptList= departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id }); //{
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? "")); // var deptList= departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
} // logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
if (model.Post_Id != oldModel.Post_Id) //}
{ //if (model.Post_Id != oldModel.Post_Id)
var postList = postRepository.GetPostListRepository( new RB_Post_ViewModel () { QPostIds = model.Post_Id + "," + oldModel.Post_Id }); //{
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? "")); // var postList = postRepository.GetPostListRepository( new RB_Post_ViewModel () { QPostIds = model.Post_Id + "," + oldModel.Post_Id });
} // logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
//}
//if (model.LeaveStatus != oldModel.LeaveStatus)
//{
// logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
//}
//if (model.LeaveTime != oldModel.LeaveTime)
//{
// logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
//}
#endregion
if (model.IDCard != oldModel.IDCard) if (model.IDCard != oldModel.IDCard)
{ {
logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard); logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard);
...@@ -119,16 +127,9 @@ namespace Edu.Module.User ...@@ -119,16 +127,9 @@ namespace Edu.Module.User
} }
if (Common.ConvertHelper.FormatDate(model.BirthDate) != Common.ConvertHelper.FormatDate(oldModel.BirthDate)) if (Common.ConvertHelper.FormatDate(model.BirthDate) != Common.ConvertHelper.FormatDate(oldModel.BirthDate))
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate),Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
}
if (model.LeaveStatus != oldModel.LeaveStatus)
{
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
}
if (model.LeaveTime != oldModel.LeaveTime)
{
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
} }
if (model.Education != oldModel.Education) if (model.Education != oldModel.Education)
{ {
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName()); logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
...@@ -144,12 +145,153 @@ namespace Edu.Module.User ...@@ -144,12 +145,153 @@ namespace Edu.Module.User
{ {
var newId = managerRepository.Insert(model); var newId = managerRepository.Insert(model);
model.MId = newId; model.MId = newId;
if (newId > 0)
{
accountModule.SetAccountModule(new RB_Account_ViewModel
{
Id = 0,
Account = model.MTel,
Password = model.Password,
AccountType = AccountTypeEnum.Admin,
AccountId = newId,
CreateBy = model.CreateBy,
CreateTime = model.CreateTime,
UpdateBy = model.UpdateBy,
UpdateTime = model.UpdateTime,
Group_Id = model.Group_Id,
School_Id = model.School_Id,
Status = 0,
AnnualLeaveDay = 0
});
model.MId = newId;
}
flag = newId > 0; flag = newId > 0;
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, "新建用户"); userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, "新建用户");
} }
return flag; return flag;
} }
/// <summary>
/// 新增修改管理者
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetManagerDeptModule(RB_Manager_ViewModel model)
{
bool flag = false;
if (model.MId > 0)
{
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.Dept_Id),model.Dept_Id },
};
string logContent = "";
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
return flag;
}
/// <summary>
/// 新增修改管理者
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetManagerPostModule(RB_Manager_ViewModel model)
{
bool flag = false;
if (model.MId > 0)
{
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.Post_Id),model.Post_Id },
};
string logContent = "";
if (model.Post_Id != oldModel.Post_Id)
{
var postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = model.Post_Id + "," + oldModel.Post_Id });
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
return flag;
}
/// <summary>
/// 新增修改管理者
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetManagerLeaveTimeModule(RB_Manager_ViewModel model)
{
bool flag = false;
if (model.MId > 0)
{
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.UpdateBy),model.UpdateBy },
{ nameof(RB_Manager_ViewModel.UpdateTime),model.UpdateTime },
{ nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Manager_ViewModel.LeaveTime),model.LeaveTime },
};
string logContent = "";
if (model.LeaveStatus != oldModel.LeaveStatus)
{
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
}
if (model.LeaveTime != oldModel.LeaveTime)
{
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
return flag;
}
/// <summary> /// <summary>
/// 根据编号获取管理者实体 /// 根据编号获取管理者实体
/// </summary> /// </summary>
......
...@@ -65,10 +65,10 @@ namespace Edu.Module.User ...@@ -65,10 +65,10 @@ namespace Edu.Module.User
/// <returns></returns> /// <returns></returns>
public List<RB_Teacher_ViewModel> GetTeacherPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Teacher_ViewModel query) public List<RB_Teacher_ViewModel> GetTeacherPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Teacher_ViewModel query)
{ {
var list= teacherRepository.GetTeacherPageListRepository(pageIndex, pageSize, out rowsCount, query); var list = teacherRepository.GetTeacherPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
string postIds=string.Join(",",list.Where(qitem=>qitem.Post_Id>0).Select(qitem=>qitem.Post_Id)); string postIds = string.Join(",", list.Where(qitem => qitem.Post_Id > 0).Select(qitem => qitem.Post_Id));
string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id)); string deptIds = string.Join(",", list.Where(qitem => qitem.Dept_Id > 0).Select(qitem => qitem.Dept_Id));
List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>(); List<RB_Post_ViewModel> postList = new List<RB_Post_ViewModel>();
List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>(); List<RB_Department_ViewModel> deptList = new List<RB_Department_ViewModel>();
...@@ -95,12 +95,12 @@ namespace Edu.Module.User ...@@ -95,12 +95,12 @@ namespace Edu.Module.User
/// <param name="model"></param> /// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param> /// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns> /// <returns></returns>
public bool SetTeacherModule(RB_Teacher_ViewModel model,bool isUpdateBasic=false) public bool SetTeacherModule(RB_Teacher_ViewModel model, bool isUpdateBasic = false)
{ {
bool flag; bool flag;
if (model.TId > 0) if (model.TId > 0)
{ {
var oldModel =GetTeacherModule(model.TId); var oldModel = GetTeacherModule(model.TId);
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{nameof(RB_Teacher_ViewModel.TeacherName),model.TeacherName }, {nameof(RB_Teacher_ViewModel.TeacherName),model.TeacherName },
...@@ -110,8 +110,8 @@ namespace Edu.Module.User ...@@ -110,8 +110,8 @@ namespace Edu.Module.User
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy }, {nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime }, {nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.School_Id),model.School_Id }, {nameof(RB_Teacher_ViewModel.School_Id),model.School_Id },
{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id }, //{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id },
{nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id }, // {nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id },
}; };
if (isUpdateBasic) if (isUpdateBasic)
{ {
...@@ -125,13 +125,13 @@ namespace Edu.Module.User ...@@ -125,13 +125,13 @@ namespace Edu.Module.User
else else
{ {
fileds.Add(nameof(RB_Teacher_ViewModel.IDCard), model.IDCard); fileds.Add(nameof(RB_Teacher_ViewModel.IDCard), model.IDCard);
fileds.Add(nameof(RB_Teacher_ViewModel.Sex),model.Sex); fileds.Add(nameof(RB_Teacher_ViewModel.Sex), model.Sex);
fileds.Add(nameof(RB_Teacher_ViewModel.EntryTime),model.EntryTime); fileds.Add(nameof(RB_Teacher_ViewModel.EntryTime), model.EntryTime);
fileds.Add(nameof(RB_Teacher_ViewModel.Address),model.Address); fileds.Add(nameof(RB_Teacher_ViewModel.Address), model.Address);
fileds.Add(nameof(RB_Teacher_ViewModel.BirthDate),model.BirthDate); fileds.Add(nameof(RB_Teacher_ViewModel.BirthDate), model.BirthDate);
fileds.Add(nameof(RB_Teacher_ViewModel.LeaveStatus),model.LeaveStatus); fileds.Add(nameof(RB_Teacher_ViewModel.LeaveStatus), model.LeaveStatus);
fileds.Add(nameof(RB_Teacher_ViewModel.LeaveTime),model.LeaveTime); // fileds.Add(nameof(RB_Teacher_ViewModel.LeaveTime),model.LeaveTime);
fileds.Add(nameof(RB_Teacher_ViewModel.Education),model.Education); fileds.Add(nameof(RB_Teacher_ViewModel.Education), model.Education);
} }
string logContent = ""; string logContent = "";
if (model.TeacherName != oldModel.TeacherName) if (model.TeacherName != oldModel.TeacherName)
...@@ -142,16 +142,7 @@ namespace Edu.Module.User ...@@ -142,16 +142,7 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.TeacherTel, oldModel.TeacherTel); logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.TeacherTel, oldModel.TeacherTel);
} }
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
}
if (model.Post_Id != oldModel.Post_Id)
{
var postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = model.Post_Id + "," + oldModel.Post_Id });
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
}
if (model.IDCard != oldModel.IDCard) if (model.IDCard != oldModel.IDCard)
{ {
logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard); logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard);
...@@ -172,6 +163,139 @@ namespace Edu.Module.User ...@@ -172,6 +163,139 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate)); logContent += string.Format(",将生日由【{0}】修改为【{1}】。", Common.ConvertHelper.FormatDate(oldModel.BirthDate), Common.ConvertHelper.FormatDate(model.BirthDate));
} }
if (model.Education != oldModel.Education)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
}
else
{
var newId = teacherRepository.Insert(model);
model.TId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 新增修改讲师
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetTeacherDeptModule(RB_Teacher_ViewModel model, bool isUpdateBasic = false)
{
bool flag;
if (model.TId > 0)
{
var oldModel = GetTeacherModule(model.TId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id },
};
string logContent = "";
if (model.Dept_Id != oldModel.Dept_Id)
{
var deptList = departmentRepository.GetDepartmentListRepository(new RB_Department_ViewModel() { QDeptIds = model.Dept_Id + "," + oldModel.Dept_Id });
logContent += string.Format(",将部门由【{0}】修改为【{1}】。", (deptList.Where(qitem => qitem.DeptId == oldModel.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""), (deptList.Where(qitem => qitem.DeptId == model.Dept_Id)?.FirstOrDefault()?.DeptName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
}
else
{
var newId = teacherRepository.Insert(model);
model.TId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 新增修改讲师
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetTeacherPostModule(RB_Teacher_ViewModel model, bool isUpdateBasic = false)
{
bool flag;
if (model.TId > 0)
{
var oldModel = GetTeacherModule(model.TId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id },
};
string logContent = "";
if (model.Post_Id != oldModel.Post_Id)
{
var postList = postRepository.GetPostListRepository(new RB_Post_ViewModel() { QPostIds = model.Post_Id + "," + oldModel.Post_Id });
logContent += string.Format(",将岗位由【{0}】修改为【{1}】。", (postList.Where(qitem => qitem.PostId == oldModel.Post_Id)?.FirstOrDefault()?.PostName ?? ""), (postList.Where(qitem => qitem.PostId == model.Post_Id)?.FirstOrDefault()?.PostName ?? ""));
}
if (!string.IsNullOrEmpty(logContent))
{
//新增日志
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, logContent);
}
flag = teacherRepository.Update(fileds, new WhereHelper(nameof(RB_Teacher_ViewModel.TId), model.TId));
}
else
{
var newId = teacherRepository.Insert(model);
model.TId = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 新增修改讲师
/// </summary>
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public bool SetTeacherLeaveTimeModule(RB_Teacher_ViewModel model, bool isUpdateBasic = false)
{
bool flag;
if (model.TId > 0)
{
var oldModel = GetTeacherModule(model.TId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Teacher_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Teacher_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Teacher_ViewModel.LeaveStatus),model.LeaveStatus },
{nameof(RB_Teacher_ViewModel.LeaveTime),model.LeaveTime }
};
string logContent = "";
if (model.LeaveStatus != oldModel.LeaveStatus) if (model.LeaveStatus != oldModel.LeaveStatus)
{ {
logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName()); logContent += string.Format(",将在职状态由【{0}】修改为【{1}】。", oldModel.LeaveStatus.ToName(), model.LeaveStatus.ToName());
...@@ -180,10 +304,6 @@ namespace Edu.Module.User ...@@ -180,10 +304,6 @@ namespace Edu.Module.User
{ {
logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime); logContent += string.Format(",将离职时间由【{0}】修改为【{1}】。", oldModel?.LeaveTime, model.LeaveTime);
} }
if (model.Education != oldModel.Education)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
}
if (!string.IsNullOrEmpty(logContent)) if (!string.IsNullOrEmpty(logContent))
{ {
//新增日志 //新增日志
...@@ -200,7 +320,6 @@ namespace Edu.Module.User ...@@ -200,7 +320,6 @@ namespace Edu.Module.User
return flag; return flag;
} }
/// <summary> /// <summary>
/// 根据教师编号获取实体 /// 根据教师编号获取实体
/// </summary> /// </summary>
......
...@@ -253,6 +253,31 @@ FROM ...@@ -253,6 +253,31 @@ FROM
{ {
where2.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.AccountType), query.AccountTypeStr); where2.AppendFormat(" AND A.{0} IN({1}) ", nameof(Employee_ViewModel.AccountType), query.AccountTypeStr);
} }
if (!string.IsNullOrEmpty(query.StartEntryTime))
{
where.AppendFormat(" AND b.{0}>='{1}' ", nameof(Employee_ViewModel.EntryTime), query.StartEntryTime);
}
if (!string.IsNullOrEmpty(query.EndEntryTime))
{
where.AppendFormat(" AND b.{0}<='{1} 23:59:59' ", nameof(Employee_ViewModel.EntryTime), query.EndEntryTime);
}
if (!string.IsNullOrEmpty(query.StartLeaveTime))
{
where.AppendFormat(" AND b.{0}>='{1}' ", nameof(Employee_ViewModel.LeaveTime), query.StartLeaveTime);
}
if (!string.IsNullOrEmpty(query.EndLeaveTime))
{
where.AppendFormat(" AND b.{0}<='{1} 23:59:59' ", nameof(Employee_ViewModel.LeaveTime), query.EndLeaveTime);
}
if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate))
{
where.AppendFormat(@"AND (
CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')) >= '{0}'
AND CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')) <= '{1}'
)", query.StartBirthDate, query.EndBirthDate);
}
} }
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
......
...@@ -37,6 +37,7 @@ namespace Edu.ThirdCore.Message ...@@ -37,6 +37,7 @@ namespace Edu.ThirdCore.Message
{ {
case "sms": case "sms":
SendSMS(obj); SendSMS(obj);
break; break;
default: default:
break; break;
......
...@@ -640,7 +640,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -640,7 +640,7 @@ namespace Edu.WebApi.Controllers.User
BirthDate = Common.ConvertHelper.FormatDate(qitem.BirthDate), BirthDate = Common.ConvertHelper.FormatDate(qitem.BirthDate),
Education = qitem.Education.ToName(), Education = qitem.Education.ToName(),
LeaveStatus = qitem.LeaveStatus.ToName(), LeaveStatus = qitem.LeaveStatus.ToName(),
LeaveStatusValue= qitem.LeaveStatus, LeaveStatusValue = qitem.LeaveStatus,
qitem.Account, qitem.Account,
qitem.AccountType, qitem.AccountType,
qitem.IsBirth, qitem.IsBirth,
...@@ -677,10 +677,116 @@ namespace Edu.WebApi.Controllers.User ...@@ -677,10 +677,116 @@ namespace Edu.WebApi.Controllers.User
extModel.UpdateTime = DateTime.Now; extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = base.UserInfo.Group_Id; extModel.Group_Id = base.UserInfo.Group_Id;
extModel.School_Id = base.UserInfo.School_Id; extModel.School_Id = base.UserInfo.School_Id;
//判断手机号码是否存在
bool existPhoneResult = employeeModule.ExistPhone(extModel);
if (existPhoneResult)
{
return ApiResult.Failed("手机号码已存在");
}
bool flag = employeeModule.SetEmployeeModule(extModel); bool flag = employeeModule.SetEmployeeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
/// <summary>
/// 修改员工的部门
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateEmployeeDept()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<Employee_ViewModel>(RequestParm.Msg.ToString());
extModel.UpdateBy = base.UserInfo.Id;
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.School_Id = base.UserInfo.School_Id;
bool flag = employeeModule.SetEmployeeDeptModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改员工的岗位
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateEmployeePost()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<Employee_ViewModel>(RequestParm.Msg.ToString());
extModel.UpdateBy = base.UserInfo.Id;
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = base.UserInfo.Group_Id;
extModel.CreateBy = base.UserInfo.Id;
extModel.School_Id = base.UserInfo.School_Id;
bool flag = employeeModule.SetEmployeePostModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 修改员工的离职信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateEmployeeLeaveTime()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<List<Employee_ViewModel>>(RequestParm.Msg.ToString());
extModel.ForEach(x => x.UpdateTime = DateTime.Now);
extModel.ForEach(x => x.UpdateBy = base.UserInfo.Id);
extModel.ForEach(x => x.Group_Id = base.UserInfo.Group_Id);
extModel.ForEach(x => x.CreateBy = base.UserInfo.Id);
extModel.ForEach(x => x.School_Id = base.UserInfo.School_Id);
bool flag = employeeModule.SetEmployeeLeaveTimeModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 批量重置用户密码信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult BatchResetUserPassword()
{
List<RB_Account_ViewModel> viewList = JsonConvert.DeserializeObject<List<RB_Account_ViewModel>>(RequestParm.Msg.ToString());
if (viewList == null || viewList.Where(x => x.AccountType > 0).Count() != viewList.Count() || viewList.Where(x => x.AccountId > 0).Count() != viewList.Count())
{
return ApiResult.Failed(message: "参数不合法,请刷新页面重试");
}
else
{
bool result = false;
//生成随机新密码
var newPwd = Common.Encrypt.PwHelper.MakePassword(8);
if (int.TryParse(RequestParm.Uid, out int uid))
{
viewList.ForEach(x => x.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id);
result = accountModule.SetBatchResetPassword(viewList, newPwd);
}
else
{
return ApiResult.Failed(message: "身份信息不合法,请尝试重新登录");
}
if (result)
{
return ApiResult.Success($"密码重置成功,用户新密码为【{newPwd}】,请复制保存");
}
else
{
return ApiResult.Failed(message: "密码重置失败");
}
}
}
/// <summary> /// <summary>
/// 获取管理者实体 /// 获取管理者实体
/// </summary> /// </summary>
...@@ -890,7 +996,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -890,7 +996,7 @@ namespace Edu.WebApi.Controllers.User
var query = new RB_Post_ViewModel() var query = new RB_Post_ViewModel()
{ {
Group_Id = base.UserInfo.Group_Id, Group_Id = base.UserInfo.Group_Id,
RB_Dept_Id=base.ParmJObj.GetInt("RB_Dept_Id"), RB_Dept_Id = base.ParmJObj.GetInt("RB_Dept_Id"),
}; };
var list = postModule.GetPostListModule(query); var list = postModule.GetPostListModule(query);
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
...@@ -990,9 +1096,9 @@ namespace Edu.WebApi.Controllers.User ...@@ -990,9 +1096,9 @@ namespace Edu.WebApi.Controllers.User
[HttpPost] [HttpPost]
public ApiResult GetEmployeeAddrBook() public ApiResult GetEmployeeAddrBook()
{ {
var query= new RB_Department_ViewModel() var query = new RB_Department_ViewModel()
{ {
Group_Id=base.ParmJObj.GetInt("Group_Id"), Group_Id = base.ParmJObj.GetInt("Group_Id"),
}; };
var list = departmentModule.GetDepartmentTreeModule(query, isQueryEmployee: true); var list = departmentModule.GetDepartmentTreeModule(query, isQueryEmployee: true);
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
}, },
"JwtSecretKey": "@VIITTOREBORN*2018", "JwtSecretKey": "@VIITTOREBORN*2018",
"JwtExpirTime": 2592000, "JwtExpirTime": 2592000,
"IsSendMsg": 1, "IsSendMsg": 2,
"AllowedHosts": "*", "AllowedHosts": "*",
"OpenValidation": "False", "OpenValidation": "False",
"UploadSiteUrl": "http://192.168.1.214:8120", "UploadSiteUrl": "http://192.168.1.214:8120",
......
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