Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
5f820cdf
Commit
5f820cdf
authored
Dec 03, 2020
by
吴春
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交员工管理
parent
88bfde8e
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
899 additions
and
109 deletions
+899
-109
Employee_ViewModel.cs
Edu.Model/ViewModel/User/Employee_ViewModel.cs
+27
-0
RB_Manager_ViewModel.cs
Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs
+5
-0
AccountModule.cs
Edu.Module.User/AccountModule.cs
+33
-2
AssistModule.cs
Edu.Module.User/AssistModule.cs
+154
-30
EmployeeModule.cs
Edu.Module.User/EmployeeModule.cs
+230
-20
ManagerModule.cs
Edu.Module.User/ManagerModule.cs
+164
-22
TeacherModule.cs
Edu.Module.User/TeacherModule.cs
+148
-29
RB_AccountRepository.cs
Edu.Repository/User/RB_AccountRepository.cs
+25
-0
MessageCore.cs
Edu.ThirdCore/Message/MessageCore.cs
+1
-0
UserController.cs
Edu.WebApi/Controllers/User/UserController.cs
+111
-5
appsettings.json
Edu.WebApi/appsettings.json
+1
-1
No files found.
Edu.Model/ViewModel/User/Employee_ViewModel.cs
View file @
5f820cdf
...
...
@@ -69,6 +69,33 @@ namespace Edu.Model.ViewModel.User
/// 员工编号【查询使用,逗号分隔】
/// </summary>
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>
/// 部门层级
...
...
Edu.Model/ViewModel/User/RB_Manager_ViewModel.cs
View file @
5f820cdf
...
...
@@ -50,6 +50,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
string
PostName
{
get
;
set
;
}
/// <summary>
/// 密码
/// </summary>
public
string
Password
{
get
;
set
;
}
/// <summary>
/// 用户类型(1-管理端,2-讲师,3-助教)
/// </summary>
...
...
Edu.Module.User/AccountModule.cs
View file @
5f820cdf
using
Edu.Common.Encrypt
;
using
Edu.AOP.CustomerAttribute
;
using
Edu.Common.Encrypt
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System
;
...
...
@@ -106,7 +107,7 @@ namespace Edu.Module.User
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
(
bool
reuslt
,
string
newPass
)
SetResetPassword
(
RB_Account_ViewModel
model
)
public
(
bool
reuslt
,
string
newPass
)
SetResetPassword
(
RB_Account_ViewModel
model
)
{
bool
flag
;
//生成随机新密码
...
...
@@ -124,5 +125,35 @@ namespace Edu.Module.User
flag
=
accountRepository
.
Update
(
fileds
,
wheres
);
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
Edu.Module.User/AssistModule.cs
View file @
5f820cdf
...
...
@@ -103,31 +103,23 @@ namespace Edu.Module.User
var
oldModel
=
GetAssistModule
(
model
.
AId
);
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
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
.
AssistTel
),
model
.
AssistTel
},
{
nameof
(
RB_Assist
.
AssistIcon
),
model
.
AssistIcon
},
{
nameof
(
RB_Assist
.
AssistIntro
),
model
.
AssistIntro
},
{
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
},
{
nameof
(
RB_Assist
.
IDCard
),
model
.
IDCard
},
{
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
=
""
;
if
(
model
.
AssistName
!=
oldModel
.
AssistName
)
{
...
...
@@ -137,15 +129,13 @@ namespace Edu.Module.User
{
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}】。"
,
(
deptList
.
Where
(
qitem
=>
qitem
.
DeptId
==
oldModel
.
Dept_Id
)?.
FirstOrDefault
()?.
DeptName
??
""
),
(
deptList
.
Where
(
qitem
=>
qitem
.
DeptId
==
model
.
Dept_Id
)?.
FirstOrDefault
()?.
DeptName
??
""
));
logContent
+=
string
.
Format
(
",将简介由【{0}】修改为【{1}】。"
,
oldModel
.
AssistIntro
,
oldModel
.
AssistIntro
);
}
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}】。"
,
(
postList
.
Where
(
qitem
=>
qitem
.
PostId
==
oldModel
.
Post_Id
)?.
FirstOrDefault
()?.
PostName
??
""
),
(
postList
.
Where
(
qitem
=>
qitem
.
PostId
==
model
.
Post_Id
)?.
FirstOrDefault
()?.
PostName
??
""
));
logContent
+=
string
.
Format
(
",将头像由【{0}】修改为【{1}】。"
,
oldModel
.
AssistIcon
,
oldModel
.
AssistIcon
);
}
if
(
model
.
IDCard
!=
oldModel
.
IDCard
)
{
...
...
@@ -157,7 +147,7 @@ namespace Edu.Module.User
}
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
)
{
...
...
@@ -167,6 +157,142 @@ namespace Edu.Module.User
{
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
)
{
logContent
+=
string
.
Format
(
",将在职状态由【{0}】修改为【{1}】。"
,
oldModel
.
LeaveStatus
.
ToName
(),
model
.
LeaveStatus
.
ToName
());
...
...
@@ -175,10 +301,7 @@ namespace Edu.Module.User
{
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
))
{
//新增日志
...
...
@@ -195,6 +318,7 @@ namespace Edu.Module.User
return
flag
;
}
/// <summary>
/// 根据编号获取助教实体
/// </summary>
...
...
Edu.Module.User/EmployeeModule.cs
View file @
5f820cdf
...
...
@@ -157,27 +157,27 @@ namespace Edu.Module.User
case
Common
.
Enum
.
User
.
AccountTypeEnum
.
Teacher
:
flag
=
teacherModule
.
SetTeacherModule
(
new
RB_Teacher_ViewModel
()
{
TId
=
extModel
.
AccountId
,
School_Id
=
extModel
.
School_Id
,
TeacherName
=
extModel
.
EmployeeName
,
TeacherTel
=
extModel
.
EmployeeTel
,
TeacherHead
=
extModel
.
UserIcon
,
Status
=
extModel
.
Status
,
CreateBy
=
extModel
.
CreateBy
,
CreateTime
=
extModel
.
CreateTime
,
UpdateBy
=
extModel
.
UpdateBy
,
UpdateTime
=
extModel
.
UpdateTime
,
Group_Id
=
extModel
.
Group_Id
,
Dept_Id
=
extModel
.
Dept_Id
,
Post_Id
=
extModel
.
Post_Id
,
IDCard
=
extModel
.
IDCard
,
Sex
=
extModel
.
Sex
,
EntryTime
=
extModel
.
EntryTime
,
TId
=
extModel
.
AccountId
,
School_Id
=
extModel
.
School_Id
,
TeacherName
=
extModel
.
EmployeeName
,
TeacherTel
=
extModel
.
EmployeeTel
,
TeacherHead
=
extModel
.
UserIcon
,
Status
=
extModel
.
Status
,
CreateBy
=
extModel
.
CreateBy
,
CreateTime
=
extModel
.
CreateTime
,
UpdateBy
=
extModel
.
UpdateBy
,
UpdateTime
=
extModel
.
UpdateTime
,
Group_Id
=
extModel
.
Group_Id
,
Dept_Id
=
extModel
.
Dept_Id
,
Post_Id
=
extModel
.
Post_Id
,
IDCard
=
extModel
.
IDCard
,
Sex
=
extModel
.
Sex
,
EntryTime
=
extModel
.
EntryTime
,
Address
=
extModel
.
Address
,
BirthDate
=
extModel
.
BirthDate
,
LeaveStatus
=
extModel
.
LeaveStatus
,
LeaveTime
=
extModel
.
LeaveTime
,
Education
=
extModel
.
Education
,
BirthDate
=
extModel
.
BirthDate
,
LeaveStatus
=
extModel
.
LeaveStatus
,
LeaveTime
=
extModel
.
LeaveTime
,
Education
=
extModel
.
Education
,
});
break
;
case
Common
.
Enum
.
User
.
AccountTypeEnum
.
Assist
:
...
...
@@ -208,5 +208,215 @@ namespace Edu.Module.User
}
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
Edu.Module.User/ManagerModule.cs
View file @
5f820cdf
...
...
@@ -58,6 +58,7 @@ namespace Edu.Module.User
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
SetManagerModule
(
RB_Manager_ViewModel
model
)
{
bool
flag
;
...
...
@@ -71,15 +72,12 @@ namespace Edu.Module.User
{
nameof
(
RB_Manager_ViewModel
.
MHead
),
model
.
MHead
},
{
nameof
(
RB_Manager_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
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
=
""
;
...
...
@@ -91,16 +89,26 @@ namespace Edu.Module.User
{
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
??
""
));
}
#
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 ?? ""));
//}
//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.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
)
{
logContent
+=
string
.
Format
(
",将身份证由【{0}】修改为【{1}】。"
,
oldModel
.
IDCard
,
model
.
IDCard
);
...
...
@@ -119,16 +127,9 @@ namespace Edu.Module.User
}
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
));
}
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
);
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
());
...
...
@@ -144,12 +145,153 @@ namespace Edu.Module.User
{
var
newId
=
managerRepository
.
Insert
(
model
);
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
;
userChangeLogModule
.
SetUserChangeLogModule
(
model
.
CreateBy
,
model
.
Group_Id
,
model
.
School_Id
,
"新建用户"
);
}
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>
...
...
Edu.Module.User/TeacherModule.cs
View file @
5f820cdf
...
...
@@ -65,10 +65,10 @@ namespace Edu.Module.User
/// <returns></returns>
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
)
{
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
));
List
<
RB_Post_ViewModel
>
postList
=
new
List
<
RB_Post_ViewModel
>();
List
<
RB_Department_ViewModel
>
deptList
=
new
List
<
RB_Department_ViewModel
>();
...
...
@@ -95,12 +95,12 @@ namespace Edu.Module.User
/// <param name="model"></param>
/// <param name="isUpdateBasic">是否更新基础资料</param>
/// <returns></returns>
public
bool
SetTeacherModule
(
RB_Teacher_ViewModel
model
,
bool
isUpdateBasic
=
false
)
public
bool
SetTeacherModule
(
RB_Teacher_ViewModel
model
,
bool
isUpdateBasic
=
false
)
{
bool
flag
;
if
(
model
.
TId
>
0
)
{
var
oldModel
=
GetTeacherModule
(
model
.
TId
);
var
oldModel
=
GetTeacherModule
(
model
.
TId
);
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Teacher_ViewModel
.
TeacherName
),
model
.
TeacherName
},
...
...
@@ -110,8 +110,8 @@ namespace Edu.Module.User
{
nameof
(
RB_Teacher_ViewModel
.
UpdateBy
),
model
.
UpdateBy
},
{
nameof
(
RB_Teacher_ViewModel
.
UpdateTime
),
model
.
UpdateTime
},
{
nameof
(
RB_Teacher_ViewModel
.
School_Id
),
model
.
School_Id
},
{
nameof
(
RB_Teacher_ViewModel
.
Dept_Id
),
model
.
Dept_Id
},
{
nameof
(
RB_Teacher_ViewModel
.
Post_Id
),
model
.
Post_Id
},
//
{nameof(RB_Teacher_ViewModel.Dept_Id),model.Dept_Id },
//
{nameof(RB_Teacher_ViewModel.Post_Id),model.Post_Id },
};
if
(
isUpdateBasic
)
{
...
...
@@ -125,13 +125,13 @@ namespace Edu.Module.User
else
{
fileds
.
Add
(
nameof
(
RB_Teacher_ViewModel
.
IDCard
),
model
.
IDCard
);
fileds
.
Add
(
nameof
(
RB_Teacher_ViewModel
.
Sex
),
model
.
Sex
);
fileds
.
Add
(
nameof
(
RB_Teacher_ViewModel
.
EntryTime
),
model
.
EntryTime
);
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
.
Education
),
model
.
Education
);
fileds
.
Add
(
nameof
(
RB_Teacher_ViewModel
.
Sex
),
model
.
Sex
);
fileds
.
Add
(
nameof
(
RB_Teacher_ViewModel
.
EntryTime
),
model
.
EntryTime
);
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
.
Education
),
model
.
Education
);
}
string
logContent
=
""
;
if
(
model
.
TeacherName
!=
oldModel
.
TeacherName
)
...
...
@@ -142,16 +142,7 @@ namespace Edu.Module.User
{
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
)
{
logContent
+=
string
.
Format
(
",将身份证由【{0}】修改为【{1}】。"
,
oldModel
.
IDCard
,
model
.
IDCard
);
...
...
@@ -172,6 +163,139 @@ namespace Edu.Module.User
{
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
)
{
logContent
+=
string
.
Format
(
",将在职状态由【{0}】修改为【{1}】。"
,
oldModel
.
LeaveStatus
.
ToName
(),
model
.
LeaveStatus
.
ToName
());
...
...
@@ -180,10 +304,6 @@ namespace Edu.Module.User
{
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
))
{
//新增日志
...
...
@@ -200,7 +320,6 @@ namespace Edu.Module.User
return
flag
;
}
/// <summary>
/// 根据教师编号获取实体
/// </summary>
...
...
Edu.Repository/User/RB_AccountRepository.cs
View file @
5f820cdf
...
...
@@ -253,6 +253,31 @@ FROM
{
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
();
...
...
Edu.ThirdCore/Message/MessageCore.cs
View file @
5f820cdf
...
...
@@ -37,6 +37,7 @@ namespace Edu.ThirdCore.Message
{
case
"sms"
:
SendSMS
(
obj
);
break
;
default
:
break
;
...
...
Edu.WebApi/Controllers/User/UserController.cs
View file @
5f820cdf
...
...
@@ -640,7 +640,7 @@ namespace Edu.WebApi.Controllers.User
BirthDate
=
Common
.
ConvertHelper
.
FormatDate
(
qitem
.
BirthDate
),
Education
=
qitem
.
Education
.
ToName
(),
LeaveStatus
=
qitem
.
LeaveStatus
.
ToName
(),
LeaveStatusValue
=
qitem
.
LeaveStatus
,
LeaveStatusValue
=
qitem
.
LeaveStatus
,
qitem
.
Account
,
qitem
.
AccountType
,
qitem
.
IsBirth
,
...
...
@@ -677,10 +677,116 @@ namespace Edu.WebApi.Controllers.User
extModel
.
UpdateTime
=
DateTime
.
Now
;
extModel
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
extModel
.
School_Id
=
base
.
UserInfo
.
School_Id
;
//判断手机号码是否存在
bool
existPhoneResult
=
employeeModule
.
ExistPhone
(
extModel
);
if
(
existPhoneResult
)
{
return
ApiResult
.
Failed
(
"手机号码已存在"
);
}
bool
flag
=
employeeModule
.
SetEmployeeModule
(
extModel
);
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>
...
...
@@ -890,7 +996,7 @@ namespace Edu.WebApi.Controllers.User
var
query
=
new
RB_Post_ViewModel
()
{
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
);
return
ApiResult
.
Success
(
data
:
list
);
...
...
@@ -990,9 +1096,9 @@ namespace Edu.WebApi.Controllers.User
[
HttpPost
]
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
);
return
ApiResult
.
Success
(
data
:
list
);
...
...
Edu.WebApi/appsettings.json
View file @
5f820cdf
...
...
@@ -12,7 +12,7 @@
},
"JwtSecretKey"
:
"@VIITTOREBORN*2018"
,
"JwtExpirTime"
:
2592000
,
"IsSendMsg"
:
1
,
"IsSendMsg"
:
2
,
"AllowedHosts"
:
"*"
,
"OpenValidation"
:
"False"
,
"UploadSiteUrl"
:
"http://192.168.1.214:8120"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment