Commit 70711ef0 authored by liudong1993's avatar liudong1993

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

parents c92c928c 9d1eed01
...@@ -25,6 +25,18 @@ namespace Edu.Common.Plugin ...@@ -25,6 +25,18 @@ namespace Edu.Common.Plugin
return jObject[key] == null ? "" : jObject[key].ToString(); return jObject[key] == null ? "" : jObject[key].ToString();
} }
/// <summary>
/// 获取日期时间
/// </summary>
/// <param name="jObject"></param>
/// <param name="key"></param>
/// <returns></returns>
public static DateTime GetDateTime(this JObject jObject, string key)
{
DateTime.TryParse(jObject[key] == null ? "" : jObject[key].ToString(), out DateTime result);
return result;
}
/// <summary> /// <summary>
/// 获取Int /// 获取Int
/// </summary> /// </summary>
......
...@@ -150,6 +150,6 @@ namespace Edu.Model.Entity.Course ...@@ -150,6 +150,6 @@ namespace Edu.Model.Entity.Course
/// <summary> /// <summary>
/// 完成进度 /// 完成进度
/// </summary> /// </summary>
public string CompleteProgress { get; set; } public int CompleteProgress { get; set; }
} }
} }
...@@ -28,15 +28,26 @@ namespace Edu.Module.User ...@@ -28,15 +28,26 @@ namespace Edu.Module.User
return accountRepository.GetAccountListRepository(query); return accountRepository.GetAccountListRepository(query);
} }
/// <summary> /// <summary>
/// 获取账号分页列表 /// 获取账号列表(批量修改密码专用)
/// </summary> /// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param> /// <param name="query"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Account_ViewModel> GetAccountPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Account_ViewModel query) public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
return accountRepository.GetUpdateAccountListRepository(query);
}
/// <summary>
/// 获取账号分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetAccountPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Account_ViewModel query)
{ {
return accountRepository.GetAccountPageListRepository(pageIndex, pageSize, out rowsCount, query); return accountRepository.GetAccountPageListRepository(pageIndex, pageSize, out rowsCount, query);
} }
......
...@@ -118,6 +118,7 @@ namespace Edu.Module.User ...@@ -118,6 +118,7 @@ namespace Edu.Module.User
{ nameof(RB_Assist.Address),model.Address }, { nameof(RB_Assist.Address),model.Address },
{ nameof(RB_Assist.BirthDate),model.BirthDate }, { nameof(RB_Assist.BirthDate),model.BirthDate },
{ nameof(RB_Assist.LeaveStatus),model.LeaveStatus }, { nameof(RB_Assist.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Assist.LeaveTime),model.LeaveTime },
{ nameof(RB_Assist.Education),model.Education }, { nameof(RB_Assist.Education),model.Education },
}; };
string logContent = ""; string logContent = "";
...@@ -157,6 +158,14 @@ namespace Edu.Module.User ...@@ -157,6 +158,14 @@ 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.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());
......
...@@ -279,7 +279,7 @@ namespace Edu.Module.User ...@@ -279,7 +279,7 @@ namespace Edu.Module.User
School_Id = extModel.School_Id, School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy, UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime, UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id Dept_Id = extModel.Dept_Id
}); });
break; break;
......
...@@ -78,6 +78,7 @@ namespace Edu.Module.User ...@@ -78,6 +78,7 @@ namespace Edu.Module.User
{ 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 = "";
...@@ -129,7 +130,14 @@ namespace Edu.Module.User ...@@ -129,7 +130,14 @@ 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.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());
......
...@@ -130,7 +130,7 @@ namespace Edu.Module.User ...@@ -130,7 +130,7 @@ namespace Edu.Module.User
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 = "";
...@@ -142,7 +142,7 @@ namespace Edu.Module.User ...@@ -142,7 +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.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);
...@@ -163,7 +163,14 @@ namespace Edu.Module.User ...@@ -163,7 +163,14 @@ 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.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());
......
...@@ -36,7 +36,7 @@ WHERE 1=1 ...@@ -36,7 +36,7 @@ WHERE 1=1
} }
if (query.AccountType > 0) if (query.AccountType > 0)
{ {
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.AccountType),query.AccountType); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.AccountType), query.AccountType);
} }
if (query.School_Id > 0) if (query.School_Id > 0)
{ {
...@@ -51,7 +51,7 @@ WHERE 1=1 ...@@ -51,7 +51,7 @@ WHERE 1=1
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id);
} }
} }
return Get<RB_Account_ViewModel>(builder.ToString(),parameters).ToList(); return Get<RB_Account_ViewModel>(builder.ToString(), parameters).ToList();
} }
/// <summary> /// <summary>
...@@ -96,7 +96,7 @@ WHERE 1=1 ...@@ -96,7 +96,7 @@ WHERE 1=1
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Id), query.Id);
} }
} }
return GetPage<RB_Account_ViewModel>(pageIndex,pageSize,out rowsCount,builder.ToString(), parameters).ToList(); return GetPage<RB_Account_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
/// <summary> /// <summary>
...@@ -193,7 +193,7 @@ FROM ...@@ -193,7 +193,7 @@ FROM
/// <param name="query"></param> /// <param name="query"></param>
/// <param name="parameters"></param> /// <param name="parameters"></param>
/// <returns></returns> /// <returns></returns>
public string GetEmployeeSqlReposiroty(Employee_ViewModel query,DynamicParameters parameters) public string GetEmployeeSqlReposiroty(Employee_ViewModel query, DynamicParameters parameters)
{ {
StringBuilder where = new StringBuilder(); StringBuilder where = new StringBuilder();
StringBuilder where2 = new StringBuilder(); StringBuilder where2 = new StringBuilder();
...@@ -284,7 +284,7 @@ FROM ...@@ -284,7 +284,7 @@ FROM
{ {
where.AppendFormat($@" AND STR_TO_DATE( CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= DATE_FORMAT('{query.EndBirthDate}' , '%Y-%m-%d') "); where.AppendFormat($@" AND STR_TO_DATE( CONCAT(DATE_FORMAT(now(),'%Y'),'-',DATE_FORMAT(b.BirthDate,'%m-%d')), '%Y-%m-%d') <= DATE_FORMAT('{query.EndBirthDate}' , '%Y-%m-%d') ");
} }
//if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate)) //if (!string.IsNullOrEmpty(query.StartBirthDate) && !string.IsNullOrEmpty(query.EndBirthDate))
//{ //{
// //OR前面是不跨年,OR后面是跨年 // //OR前面是不跨年,OR后面是跨年
...@@ -341,7 +341,7 @@ WHERE 1=1 {4} ...@@ -341,7 +341,7 @@ WHERE 1=1 {4}
/// </summary> /// </summary>
/// <param name="EmpId"></param> /// <param name="EmpId"></param>
/// <returns></returns> /// <returns></returns>
public Employee_ViewModel GetEmployeeInfo(int EmpId) public Employee_ViewModel GetEmployeeInfo(int EmpId)
{ {
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
StringBuilder where = new StringBuilder(); StringBuilder where = new StringBuilder();
...@@ -373,5 +373,50 @@ FROM ...@@ -373,5 +373,50 @@ FROM
var model = Get<Employee_ViewModel>(builder.ToString(), parameters).FirstOrDefault(); var model = Get<Employee_ViewModel>(builder.ToString(), parameters).FirstOrDefault();
return model; return model;
} }
/// <summary>
/// 获取账号列表(批量修改密码专用)
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
StringBuilder builderWhere = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_account AS A
WHERE 1=1
");
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Status), (int)DateStateEnum.Normal);
if (query != null && query.Any())
{
if (query.FirstOrDefault().Group_Id > 0)
{
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Account_ViewModel.Group_Id), query.FirstOrDefault().Group_Id);
}
foreach (var item in query)
{
if (item.AccountType > 0 && item.AccountId > 0)
{
if (!string.IsNullOrWhiteSpace(builderWhere.ToString()))
{
builderWhere.AppendFormat(" or ( a.{0}={1} and a.{2}={3} ) ", nameof(RB_Account_ViewModel.AccountType),(int) item.AccountType, nameof(RB_Account_ViewModel.AccountId), item.AccountId);
}
else {
builderWhere.AppendFormat(" ( a.{0}={1} and a.{2}={3} ) ", nameof(RB_Account_ViewModel.AccountType), (int)item.AccountType, nameof(RB_Account_ViewModel.AccountId), item.AccountId);
}
}
}
builder.AppendFormat(" and ( {0} ) ", builderWhere.ToString());
}
return Get<RB_Account_ViewModel>(builder.ToString(), parameters).ToList();
}
} }
} }
\ No newline at end of file
...@@ -64,7 +64,7 @@ WHERE 1=1 ...@@ -64,7 +64,7 @@ WHERE 1=1
builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Assist_ViewModel.Teacher_Id), query.Teacher_Id); builder.AppendFormat(" AND a.{0}={1} ", nameof(RB_Assist_ViewModel.Teacher_Id), query.Teacher_Id);
} }
} }
return Get<RB_Assist_ViewModel>(builder.ToString()).ToList(); return Get<RB_Assist_ViewModel>(builder.ToString(), parameters).ToList();
} }
......
...@@ -70,7 +70,7 @@ WHERE 1=1 ...@@ -70,7 +70,7 @@ WHERE 1=1
builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.TId), query.TId); builder.AppendFormat(" AND t.{0}={1} ", nameof(RB_Teacher_ViewModel.TId), query.TId);
} }
} }
return Get<RB_Teacher_ViewModel>(builder.ToString()).ToList(); return Get<RB_Teacher_ViewModel>(builder.ToString(), parameters).ToList();
} }
......
...@@ -95,13 +95,35 @@ namespace Edu.WebApi.Controllers.Course ...@@ -95,13 +95,35 @@ namespace Edu.WebApi.Controllers.Course
[HttpPost] [HttpPost]
public ApiResult SetClass() public ApiResult SetClass()
{ {
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_ViewModel>(RequestParm.Msg.ToString()); var extModel = new RB_Class_ViewModel()
extModel.CreateTime = DateTime.Now; {
extModel.CreateBy = UserInfo.Id; CreateBy = UserInfo.Id,
extModel.UpdateBy = UserInfo.Id; CreateTime = DateTime.Now,
extModel.UpdateTime = DateTime.Now; UpdateBy = UserInfo.Id,
extModel.Group_Id = this.UserInfo.Group_Id; UpdateTime = DateTime.Now,
extModel.School_Id = this.UserInfo.School_Id; Group_Id = this.UserInfo.Group_Id,
ClassName = base.ParmJObj.GetStringValue("ClassName"),
CouseId = base.ParmJObj.GetInt("CouseId"),
Teacher_Id = base.ParmJObj.GetInt("Teacher_Id"),
Assist_Id = base.ParmJObj.GetInt("Assist_Id"),
ClassPersion = base.ParmJObj.GetInt("ClassPersion"),
OpenTime = base.ParmJObj.GetDateTime("OpenTime"),
EndOrderTime=base.ParmJObj.GetDateTime("EndOrderTime"),
OriginalPrice=base.ParmJObj.GetDecimal("OriginalPrice"),
SellPrice=base.ParmJObj.GetDecimal("SellPrice"),
IsStepPrice=base.ParmJObj.GetInt("IsStepPrice"),
ClassRoomId=base.ParmJObj.GetInt("ClassRoomId"),
IsOpenCommission=base.ParmJObj.GetInt("IsOpenCommission"),
CommissionType=base.ParmJObj.GetInt("CommissionType"),
CommissionValue=base.ParmJObj.GetDecimal("CommissionValue"),
ClassHours=base.ParmJObj.GetInt("ClassHours"),
ClassStyle=(ClassStyleEnum)base.ParmJObj.GetInt("ClassStyle"),
ClassStatus=(ClassStatusEnum)base.ParmJObj.GetInt("ClassStatus"),
InnerRemark= base.ParmJObj.GetStringValue("InnerRemark"),
OutRemark=base.ParmJObj.GetStringValue("OutRemark"),
CompleteProgress=base.ParmJObj.GetInt("CompleteProgress"),
School_Id=base.ParmJObj.GetInt("School_Id"),
};
bool flag = classModule.SetClassModule(extModel); bool flag = classModule.SetClassModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
......
...@@ -630,7 +630,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -630,7 +630,7 @@ namespace Edu.WebApi.Controllers.User
pageModel.Count = rowsCount; pageModel.Count = rowsCount;
pageModel.PageData = list.Select((qitem, i) => new pageModel.PageData = list.Select((qitem, i) => new
{ {
Id = i + 1, Id = (pageModel.PageSize* (pageModel.PageIndex-1)) +i + 1,
// qitem.Id, // qitem.Id,
qitem.UserIcon, qitem.UserIcon,
qitem.EmployeeName, qitem.EmployeeName,
...@@ -774,7 +774,13 @@ namespace Edu.WebApi.Controllers.User ...@@ -774,7 +774,13 @@ namespace Edu.WebApi.Controllers.User
if (int.TryParse(RequestParm.Uid, out int uid)) if (int.TryParse(RequestParm.Uid, out int uid))
{ {
viewList.ForEach(x => x.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id); viewList.ForEach(x => x.Group_Id = UserReidsCache.GetUserLoginInfo(uid).Group_Id);
result = accountModule.SetBatchResetPassword(viewList, newPwd); //判断账户信息是否存在,不存在就不去更新密码
var list = accountModule.GetUpdateAccountListRepository(viewList);
if (list != null && list.Any())
{
result = accountModule.SetBatchResetPassword(list, newPwd);
}
} }
else else
{ {
......
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