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
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>
/// 获取Int
/// </summary>
......
......@@ -150,6 +150,6 @@ namespace Edu.Model.Entity.Course
/// <summary>
/// 完成进度
/// </summary>
public string CompleteProgress { get; set; }
public int CompleteProgress { get; set; }
}
}
......@@ -28,6 +28,17 @@ namespace Edu.Module.User
return accountRepository.GetAccountListRepository(query);
}
/// <summary>
/// 获取账号列表(批量修改密码专用)
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Account_ViewModel> GetUpdateAccountListRepository(List<RB_Account_ViewModel> query)
{
return accountRepository.GetUpdateAccountListRepository(query);
}
/// <summary>
/// 获取账号分页列表
/// </summary>
......
......@@ -118,6 +118,7 @@ namespace Edu.Module.User
{ nameof(RB_Assist.Address),model.Address },
{ nameof(RB_Assist.BirthDate),model.BirthDate },
{ nameof(RB_Assist.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Assist.LeaveTime),model.LeaveTime },
{ nameof(RB_Assist.Education),model.Education },
};
string logContent = "";
......@@ -157,6 +158,14 @@ namespace Edu.Module.User
{
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)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
......@@ -279,7 +279,7 @@ namespace Edu.Module.User
School_Id = extModel.School_Id,
UpdateBy = extModel.UpdateBy,
UpdateTime = extModel.UpdateTime,
Post_Id = extModel.Post_Id
Dept_Id = extModel.Dept_Id
});
break;
......
......@@ -78,6 +78,7 @@ namespace Edu.Module.User
{ nameof(RB_Manager_ViewModel.Address),model.Address },
{ nameof(RB_Manager_ViewModel.BirthDate),model.BirthDate },
{ nameof(RB_Manager_ViewModel.LeaveStatus),model.LeaveStatus },
{ nameof(RB_Manager_ViewModel.LeaveTime),model.LeaveTime },
{ nameof(RB_Manager_ViewModel.Education),model.Education },
};
string logContent = "";
......@@ -129,7 +130,14 @@ namespace Edu.Module.User
{
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)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
......@@ -130,7 +130,7 @@ namespace Edu.Module.User
fileds.Add(nameof(RB_Teacher_ViewModel.Address), model.Address);
fileds.Add(nameof(RB_Teacher_ViewModel.BirthDate), model.BirthDate);
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);
}
string logContent = "";
......@@ -163,7 +163,14 @@ namespace Edu.Module.User
{
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)
{
logContent += string.Format(",将学历由【{0}】修改为【{1}】。", oldModel.Education.ToName(), model.Education.ToName());
......
......@@ -36,7 +36,7 @@ WHERE 1=1
}
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)
{
......@@ -51,7 +51,7 @@ WHERE 1=1
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>
......@@ -96,7 +96,7 @@ WHERE 1=1
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>
......@@ -193,7 +193,7 @@ FROM
/// <param name="query"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public string GetEmployeeSqlReposiroty(Employee_ViewModel query,DynamicParameters parameters)
public string GetEmployeeSqlReposiroty(Employee_ViewModel query, DynamicParameters parameters)
{
StringBuilder where = new StringBuilder();
StringBuilder where2 = new StringBuilder();
......@@ -373,5 +373,50 @@ FROM
var model = Get<Employee_ViewModel>(builder.ToString(), parameters).FirstOrDefault();
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
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
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
[HttpPost]
public ApiResult SetClass()
{
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Class_ViewModel>(RequestParm.Msg.ToString());
extModel.CreateTime = DateTime.Now;
extModel.CreateBy = UserInfo.Id;
extModel.UpdateBy = UserInfo.Id;
extModel.UpdateTime = DateTime.Now;
extModel.Group_Id = this.UserInfo.Group_Id;
extModel.School_Id = this.UserInfo.School_Id;
var extModel = new RB_Class_ViewModel()
{
CreateBy = UserInfo.Id,
CreateTime = DateTime.Now,
UpdateBy = UserInfo.Id,
UpdateTime = DateTime.Now,
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);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
......
......@@ -630,7 +630,7 @@ namespace Edu.WebApi.Controllers.User
pageModel.Count = rowsCount;
pageModel.PageData = list.Select((qitem, i) => new
{
Id = i + 1,
Id = (pageModel.PageSize* (pageModel.PageIndex-1)) +i + 1,
// qitem.Id,
qitem.UserIcon,
qitem.EmployeeName,
......@@ -774,7 +774,13 @@ namespace Edu.WebApi.Controllers.User
if (int.TryParse(RequestParm.Uid, out int uid))
{
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
{
......
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