Commit aa887a90 authored by 黄奎's avatar 黄奎

新增页面

parent c32052d4
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace Edu.Common.Plugin
{
......@@ -48,12 +45,10 @@ namespace Edu.Common.Plugin
{
// 定义正则表达式用来匹配 img 标签
Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?[\s\t\r\n]*>", RegexOptions.IgnoreCase);
// 搜索匹配的字符串
MatchCollection matches = regImg.Matches(sHtmlText);
int i = 0;
string[] sUrlList = new string[matches.Count];
// 取得匹配项列表
foreach (Match match in matches)
sUrlList[i++] = match.Groups["imgUrl"].Value;
......@@ -160,7 +155,6 @@ namespace Edu.Common.Plugin
/// <returns></returns>
public static void GetImgParm(string imgUrl, out int width, out int height)
{
Regex regWidth = new Regex(@"width=(?<width>\d+)", RegexOptions.IgnoreCase);
MatchCollection mcWidth = regWidth.Matches(imgUrl);
if (mcWidth.Count > 0)
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
......@@ -67,7 +67,6 @@ namespace Edu.Model.Entity.User
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 部门编号
/// </summary>
......
......@@ -49,5 +49,10 @@ namespace Edu.Model.ViewModel.User
/// 岗位名称
/// </summary>
public string PostName { get; set; }
/// <summary>
/// 用户类型(1-管理端,2-讲师,3-助教)
/// </summary>
public int UserType { get; set; }
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
</ItemGroup>
</Project>
......@@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.LogModule
namespace Edu.Module.Log
{
public class UserChangeLogModule
{
......@@ -32,5 +32,27 @@ namespace Edu.LogModule
{
return changeLogRepository.Insert(extModel) > 0;
}
/// <summary>
/// 新增日志
/// </summary>
/// <param name="CreateBy">创建人</param>
/// <param name="GroupId">集团编号</param>
/// <param name="SchoolId">校区编号</param>
/// <param name="content">日志内容</param>
/// <returns></returns>
public bool SetUserChangeLogModule(int CreateBy, int GroupId,int SchoolId,string content)
{
RB_User_ChangeLog_ViewModel model = new RB_User_ChangeLog_ViewModel()
{
Id = 0,
CreateBy = CreateBy,
CreateTime = DateTime.Now,
Group_Id = GroupId,
School_Id = SchoolId,
LogContent = content
};
return changeLogRepository.Insert(model);
}
}
}
......@@ -142,10 +142,28 @@ namespace Edu.Module.User
deptList = new List<RB_Department_ViewModel>();
}
//校区部门
List<DepartmentTree_ViewModel> schoolDeptList = new List<DepartmentTree_ViewModel>();
if (schoolList != null)
{
foreach (var item in schoolList)
{
DepartmentTree_ViewModel tModel = new DepartmentTree_ViewModel()
{
DeptId = item.SId+item.Group_Id,
DeptName = item.SName,
ParentId = item.Dept_Id,
ChildList = new List<DepartmentTree_ViewModel>()
};
tModel.ChildList = GetDeptTreeList(0, deptList.Where(qitem => qitem.School_Id > 0).ToList(), SchoolId:item.SId,null);
schoolDeptList.Add(tModel);
}
}
List<DepartmentTree_ViewModel> list = new List<DepartmentTree_ViewModel>();
if (deptList != null && deptList.Count > 0)
{
var firstList = deptList.Where(qitem => qitem.ParentId == 0).ToList();
var firstList = deptList.Where(qitem => qitem.ParentId == 0 && qitem.School_Id==0).ToList();
if (firstList != null && firstList.Count > 0)
{
foreach (var fItem in firstList)
......@@ -157,7 +175,15 @@ namespace Edu.Module.User
ParentId = fItem.ParentId,
ChildList = new List<DepartmentTree_ViewModel>()
};
tModel.ChildList = GetDeptTreeList(fItem.DeptId, deptList);
tModel.ChildList = GetDeptTreeList(fItem.DeptId, deptList.Where(qitem=>qitem.School_Id==0).ToList(),SchoolId:0, schoolDeptList);
if (schoolDeptList != null)
{
var newSchoolDeptList = schoolDeptList.Where(qitem => qitem.DeptId == fItem.DeptId)?.ToList();
if (newSchoolDeptList != null && newSchoolDeptList.Count>0)
{
tModel.ChildList.AddRange(newSchoolDeptList);
}
}
list.Add(tModel);
}
}
......@@ -165,15 +191,19 @@ namespace Edu.Module.User
return list;
}
/// <summary>
/// 递归生成树形结构
/// </summary>
/// <param name="parentId">父节点编号</param>
/// <param name="sourceList">数据源列表</param>
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList)
private List<DepartmentTree_ViewModel> GetDeptTreeList(int parentId, List<RB_Department_ViewModel> sourceList,int SchoolId=0, List<DepartmentTree_ViewModel> schoolDeptList=null)
{
List<DepartmentTree_ViewModel> treeList = new List<DepartmentTree_ViewModel>();
foreach (var item in sourceList.Where(qitem => qitem.ParentId == parentId))
foreach (var item in sourceList.Where(qitem => qitem.ParentId == parentId && qitem.School_Id== SchoolId))
{
DepartmentTree_ViewModel model = new DepartmentTree_ViewModel()
{
......@@ -182,7 +212,15 @@ namespace Edu.Module.User
ParentId = item.ParentId,
ChildList = new List<DepartmentTree_ViewModel>(),
};
model.ChildList = GetDeptTreeList(item.DeptId, sourceList);
model.ChildList = GetDeptTreeList(item.DeptId, sourceList, SchoolId, schoolDeptList);
if (schoolDeptList != null)
{
var newSchoolDeptList = schoolDeptList.Where(qitem => qitem.ParentId == item.DeptId)?.ToList();
if (newSchoolDeptList != null)
{
model.ChildList.AddRange(newSchoolDeptList);
}
}
treeList.Add(model);
}
return treeList;
......
......@@ -8,6 +8,7 @@
<ProjectReference Include="..\Edu.Aop\Edu.Aop.csproj" />
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Module.Log\Edu.Module.Log.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
</ItemGroup>
......
using Edu.AOP.CustomerAttribute;
using Edu.Common.Enum;
using Edu.Common.Enum.User;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
using Edu.Model.ViewModel.User;
using Edu.Module.Log;
using Edu.Repository.User;
using System;
using System.Collections.Generic;
......@@ -36,6 +38,11 @@ namespace Edu.Module.User
/// </summary>
private readonly RB_DepartmentRepository departmentRepository = new RB_DepartmentRepository();
/// <summary>
/// 用户信息日志处理类对象
/// </summary>
private readonly UserChangeLogModule userChangeLogModule = new UserChangeLogModule();
/// <summary>
/// 获取管理者列表
/// </summary>
......@@ -56,7 +63,7 @@ namespace Edu.Module.User
/// <returns></returns>
public List<AdminEmp_ViewModel> GetAdminEmpPageListModule(int pageIndex, int pageSize, out long rowsCount, AdminEmp_ViewModel query)
{
var list= managerRepository.GetAdminEmpPageListRepository(pageIndex, pageSize, out rowsCount, query);
var list = managerRepository.GetAdminEmpPageListRepository(pageIndex, pageSize, out rowsCount, query);
if (list != null && list.Count > 0)
{
string postIds = string.Join(",", list.Where(qitem => qitem.Post_Id > 0).Select(qitem => qitem.Post_Id));
......@@ -76,8 +83,10 @@ namespace Edu.Module.User
public bool SetManagerModule(RB_Manager_ViewModel model)
{
bool flag;
if (model.MId > 0)
{
var oldModel = GetManagerModule(model.MId);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Manager_ViewModel.MName),model.MName.Trim()},
......@@ -87,7 +96,71 @@ namespace Edu.Module.User
{ 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.Sex),model.Sex },
{ nameof(RB_Manager_ViewModel.EntryTime),model.EntryTime },
{ 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 = "";
if (model.MName != oldModel.MName)
{
logContent += string.Format(",将姓名由【{0}】修改为【{1}】。", oldModel.MName, oldModel.MName);
}
if (model.MTel != oldModel.MTel)
{
logContent += string.Format(",将电话由【{0}】修改为【{1}】。", oldModel.MTel, oldModel.MTel);
}
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)
{
logContent += string.Format(",将身份证由【{0}】修改为【{1}】。", oldModel.IDCard, model.IDCard);
}
if (model.Sex != oldModel.Sex)
{
logContent += string.Format(",将性别由【{0}】修改为【{1}】。", oldModel.Sex, model.Sex);
}
if (model.EntryTime != oldModel.EntryTime)
{
logContent += string.Format(",将入职时间由【{0}】修改为【{1}】。", oldModel.EntryTime, model.EntryTime);
}
if (model.Address != oldModel.Address)
{
logContent += string.Format(",将地址由【{0}】修改为【{1}】。", oldModel.Address, model.Address);
}
if (model.BirthDate != oldModel.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)
{
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 = managerRepository.Update(fileds, new WhereHelper(nameof(RB_Manager_ViewModel.MId), model.MId));
}
else
......@@ -95,6 +168,7 @@ namespace Edu.Module.User
var newId = managerRepository.Insert(model);
model.MId = newId;
flag = newId > 0;
userChangeLogModule.SetUserChangeLogModule(model.CreateBy, model.Group_Id, model.School_Id, "新建用户");
}
return flag;
}
......@@ -106,7 +180,8 @@ namespace Edu.Module.User
/// <returns></returns>
public RB_Manager_ViewModel GetManagerModule(int MId)
{
return managerRepository.GetEntity<RB_Manager_ViewModel>(MId);
var extModel = managerRepository.GetEntity<RB_Manager_ViewModel>(MId);
return extModel;
}
/// <summary>
......
using Edu.Model.Entity.Log;
using Edu.Model.ViewModel.Log;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
......@@ -8,7 +7,7 @@ using System.Text;
namespace Edu.Repository.Log
{
/// <summary>
/// 用户信息改变日志
/// 用户信息改变日志仓储层
/// </summary>
public class RB_User_ChangeLogRepository : BaseRepository<RB_User_ChangeLog>
{
......
......@@ -291,12 +291,12 @@ namespace Edu.WebApi.Controllers.Public
#region 上传设置
public ApiResult GetFileStoreList()
{
var parms = RequestParm;
var query = new RB_File_Store();
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var query = new RB_File_Store
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.UserInfo.School_Id
};
var list = publicModule.GetFileStoreList(query);
return ApiResult.Success("获取成功", list);
}
......@@ -306,7 +306,6 @@ namespace Edu.WebApi.Controllers.Public
/// <returns></returns>
public ApiResult AddOrUpdateFileStore()
{
var parms = RequestParm;
var query = Common.Plugin.JsonHelper.DeserializeObject<RB_File_Store>(RequestParm.Msg.ToString());
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
......@@ -319,11 +318,8 @@ namespace Edu.WebApi.Controllers.Public
{
if ((int)query.StoreType == 0)
{
return ApiResult.Failed("请选择存储位置");
}
if (query.ID == 0)
{
query.CreateDate = System.DateTime.Now;
......@@ -348,10 +344,11 @@ namespace Edu.WebApi.Controllers.Public
/// <returns></returns>
public ApiResult GetFileStoreDetail()
{
var parms = RequestParm;
var query = new RB_File_Store();
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var query = new RB_File_Store
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.UserInfo.School_Id
};
var model = publicModule.GetFileStoreList(query).FirstOrDefault();
if (model == null)
{
......@@ -379,9 +376,11 @@ namespace Edu.WebApi.Controllers.Public
/// <returns></returns>
public ApiResult GetDefaultFileStore()
{
var query = new RB_File_Store();
query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id;
var query = new RB_File_Store
{
Group_Id = base.UserInfo.Group_Id,
School_Id = base.UserInfo.School_Id
};
var model = publicModule.GetFileStoreList(query).Where(x => x.IsDefault == 1).FirstOrDefault();
if (model == null)
{
......
......@@ -639,7 +639,7 @@ namespace Edu.WebApi.Controllers.User
Sex = qitem.Sex == 0 ? "男" : "女",
BirthDate = Common.ConvertHelper.FormatDate(qitem.BirthDate),
Education = qitem.Education.ToName(),
LeaveStatus=qitem.LeaveStatus.ToName(),
LeaveStatus = qitem.LeaveStatus.ToName(),
qitem.EmployeeId,
qitem.Account,
qitem.AccountType,
......@@ -768,7 +768,7 @@ namespace Edu.WebApi.Controllers.User
public ApiResult GetChildDepartment()
{
int DeptId = base.ParmJObj.GetInt("DeptId");
if (DeptId<=0)
if (DeptId <= 0)
{
return ApiResult.ParamIsNull(message: "请选择部门编号!");
}
......@@ -804,8 +804,6 @@ namespace Edu.WebApi.Controllers.User
return ApiResult.Success(data: obj);
}
/// <summary>
/// 添加修改部门
/// </summary>
......@@ -958,7 +956,7 @@ namespace Edu.WebApi.Controllers.User
Dept_Id = base.ParmJObj.GetInt("Dept_Id"),
QDeptIds = base.ParmJObj.GetStringValue("QDeptIds"),
EmployeeName = base.ParmJObj.GetStringValue("EmployeeName"),//姓名
AccountTypeStr=base.ParmJObj.GetStringValue("AccountTypeStr"),//人员类型【逗号分割】
AccountTypeStr = base.ParmJObj.GetStringValue("AccountTypeStr"),//人员类型【逗号分割】
};
query.Group_Id = base.UserInfo.Group_Id;
var list = employeeModule.GetEmployeeListModule(query);
......@@ -979,5 +977,38 @@ namespace Edu.WebApi.Controllers.User
}));
}
#endregion
#region 枚举相列表
/// <summary>
/// 获取学历列表
/// </summary>
/// <returns></returns>
public ApiResult GetEducationList()
{
var list = Common.Plugin.EnumHelper.EnumToList(typeof(EducationEnum));
list.Insert(0, new EnumItem()
{
Id = 0,
Name = "不限"
});
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取离职状态列表
/// </summary>
/// <returns></returns>
public ApiResult GetLeaveStatus()
{
var list = Common.Plugin.EnumHelper.EnumToList(typeof(LeaveStatusEnum));
list.Insert(0, new EnumItem()
{
Id = 0,
Name = "不限"
});
return ApiResult.Success(data: list);
}
#endregion
}
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Module.User", "Edu.Modu
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Module.Public", "Edu.Module.Public\Edu.Module.Public.csproj", "{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edu.LogModule", "Edu.LogModule\Edu.LogModule.csproj", "{5EF242B0-95E1-4D6B-884A-AD0050BA1818}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edu.Module.Log", "Edu.Module.Log\Edu.Module.Log.csproj", "{809E4C87-97F6-4DCB-9232-9C70ECEF2655}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -89,10 +89,10 @@ Global
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5}.Release|Any CPU.Build.0 = Release|Any CPU
{5EF242B0-95E1-4D6B-884A-AD0050BA1818}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EF242B0-95E1-4D6B-884A-AD0050BA1818}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EF242B0-95E1-4D6B-884A-AD0050BA1818}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EF242B0-95E1-4D6B-884A-AD0050BA1818}.Release|Any CPU.Build.0 = Release|Any CPU
{809E4C87-97F6-4DCB-9232-9C70ECEF2655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{809E4C87-97F6-4DCB-9232-9C70ECEF2655}.Debug|Any CPU.Build.0 = Debug|Any CPU
{809E4C87-97F6-4DCB-9232-9C70ECEF2655}.Release|Any CPU.ActiveCfg = Release|Any CPU
{809E4C87-97F6-4DCB-9232-9C70ECEF2655}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -108,7 +108,7 @@ Global
{F3E4D4C5-FD08-44DE-AB65-850071BE7FEF} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{AD259CCC-048A-4F65-A368-91B8B4A9F200} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{8E34CE2D-AAF3-481C-A5E3-5AECC8F7F1B5} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{5EF242B0-95E1-4D6B-884A-AD0050BA1818} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{809E4C87-97F6-4DCB-9232-9C70ECEF2655} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8763B446-FAB1-46BF-9743-F2628533241B}
......
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