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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -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);
...@@ -982,7 +1088,7 @@ namespace Edu.WebApi.Controllers.User ...@@ -982,7 +1088,7 @@ namespace Edu.WebApi.Controllers.User
qitem.PostName qitem.PostName
})); }));
} }
/// <summary> /// <summary>
/// 获取部门员工树形列表 /// 获取部门员工树形列表
/// </summary> /// </summary>
...@@ -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