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
0269469c
Commit
0269469c
authored
Nov 30, 2020
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
59314691
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6988 additions
and
0 deletions
+6988
-0
AttendanceModule.cs
Edu.Module.User/AttendanceModule.cs
+582
-0
NoticeModule.cs
Edu.Module.User/NoticeModule.cs
+349
-0
WorkFlowManagementModule.cs
Edu.Module.User/WorkFlowManagementModule.cs
+717
-0
WorkFlowModule.cs
Edu.Module.User/WorkFlowModule.cs
+5340
-0
No files found.
Edu.Module.User/AttendanceModule.cs
0 → 100644
View file @
0269469c
using
Edu.Common.API
;
using
Edu.Common.Enum.User
;
using
Edu.Common.Plugin
;
using
Edu.Model.CacheModel
;
using
Edu.Model.Entity.User
;
using
Edu.Model.Public
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Edu.Module.User
{
/// <summary>
/// 考勤处理类
/// </summary>
public
class
AttendanceModule
{
private
Rb_attendanceRepository
respository
=
new
Rb_attendanceRepository
();
private
Rb_attendance_wayRepository
AWrespository
=
new
Rb_attendance_wayRepository
();
private
Rb_workdaysetingRepository
WDrespository
=
new
Rb_workdaysetingRepository
();
private
Rb_technicaldatesRepository
TDrespository
=
new
Rb_technicaldatesRepository
();
private
Rb_Workflow_AskforleaveRepository
AskforleaveRepository
=
new
Rb_Workflow_AskforleaveRepository
();
private
Rb_technicaldatesRepository
technicaldatesRepository
=
new
Rb_technicaldatesRepository
();
private
Rb_workdaysetingRepository
workdaysetingRepository
=
new
Rb_workdaysetingRepository
();
private
Rb_attendance_recordRepository
RecordRepository
=
new
Rb_attendance_recordRepository
();
private
Rb_dictvalueRepository
dictvalueRepository
=
new
Rb_dictvalueRepository
();
/// <summary>
/// 部门
/// </summary>
private
readonly
RB_DepartmentRepository
departmentRepository
=
new
RB_DepartmentRepository
();
/// <summary>
/// 账号
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 获取公司所有数据
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Extend
>
GetPageList
(
int
pageIndex
,
int
pageSize
,
RB_Attendance_Extend
dmodel
,
out
long
count
,
int
groupId
)
{
var
pageList
=
respository
.
GetPageListNew
(
pageIndex
,
pageSize
,
dmodel
,
out
count
,
groupId
);
return
pageList
;
}
/// <summary>
/// 根据id获取数据
/// </summary>
/// <param name="attendanceId"></param>
/// <returns></returns>
public
RB_Attendance_Extend
Get
(
int
attendanceId
)
{
//获取 需要同时获取 特殊日期表 工作日表 考勤方式表数据
var
amodel
=
respository
.
GetEntity
<
RB_Attendance_Extend
>(
attendanceId
);
var
AWmodel
=
respository
.
GetAWList
(
attendanceId
,
1
);
var
AWWifimodel
=
respository
.
GetAWList
(
attendanceId
,
2
);
var
TDmodel
=
respository
.
GetTDList
(
attendanceId
,
1
);
//2019-09-23 Add by :W 某一个部门或者人可以打卡,查询所属部门或者人
if
(
TDmodel
!=
null
&&
TDmodel
.
Any
())
{
//查询部门信息
string
deptIds
=
string
.
Join
(
","
,
TDmodel
.
Where
(
x
=>
x
.
RB_Department_Id
>
0
).
Select
(
x
=>
x
.
RB_Department_Id
));
if
(!
string
.
IsNullOrWhiteSpace
(
deptIds
))
{
var
deptList
=
departmentRepository
.
GetDepartmentListRepository
(
new
RB_Department_ViewModel
()
{
QDeptIds
=
deptIds
});
TDmodel
.
Where
(
x
=>
x
.
RB_Department_Id
>
0
).
ToList
().
ForEach
(
x
=>
x
.
DepartmentName
=
deptList
.
FirstOrDefault
(
y
=>
y
.
DeptId
==
x
.
RB_Department_Id
)?.
DeptName
);
}
string
employeeIds
=
string
.
Join
(
","
,
TDmodel
.
Where
(
x
=>
x
.
EmployeeId
>
0
).
Select
(
x
=>
x
.
EmployeeId
));
if
(!
string
.
IsNullOrWhiteSpace
(
employeeIds
))
{
var
employeeList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
employeeIds
});
TDmodel
.
Where
(
x
=>
x
.
EmployeeId
>
0
).
ToList
().
ForEach
(
x
=>
x
.
EmployeeName
=
employeeList
.
FirstOrDefault
(
y
=>
y
.
Id
==
x
.
EmployeeId
)?.
EmployeeName
);
}
}
var
NotTDmodel
=
respository
.
GetTDList
(
attendanceId
,
2
);
var
WDmodel
=
respository
.
GetWDList
(
attendanceId
);
string
[]
workDayList
=
new
string
[]
{
"周一"
,
"周二"
,
"周三"
,
"周四"
,
"周五"
,
"周六"
,
"周日"
};
List
<
RB_WorkdaySeting_Extend
>
wdsList
=
new
List
<
RB_WorkdaySeting_Extend
>();
if
(
WDmodel
.
Count
!=
8
)
{
//数据库里没得一周的数据
foreach
(
string
wdstr
in
workDayList
)
{
var
wdList
=
WDmodel
.
Where
(
x
=>
x
.
Workday
==
wdstr
).
ToList
();
RB_WorkdaySeting_Extend
wdsmodel
=
new
RB_WorkdaySeting_Extend
();
if
(
wdList
.
Count
<=
0
)
{
wdsmodel
=
new
RB_WorkdaySeting_Extend
()
{
AttendanceId
=
attendanceId
,
Workday
=
wdstr
,
BeOnDutyTime
=
""
,
OffDutyTime
=
""
,
IsCheck
=
0
};
}
else
{
var
model
=
wdList
[
0
];
wdsmodel
=
new
RB_WorkdaySeting_Extend
()
{
AttendanceId
=
model
.
AttendanceId
,
Workday
=
model
.
Workday
,
BeOnDutyTime
=
model
.
BeOnDutyTime
,
OffDutyTime
=
model
.
OffDutyTime
,
IsCheck
=
1
};
}
wdsList
.
Add
(
wdsmodel
);
}
}
if
(
amodel
!=
null
)
{
amodel
.
WdList
=
wdsList
;
amodel
.
TdList
=
TDmodel
;
amodel
.
AwList
=
AWmodel
;
amodel
.
NottdList
=
NotTDmodel
;
amodel
.
AwWifiList
=
AWWifimodel
;
}
return
amodel
;
}
/// <summary>
/// 验证
/// </summary>
/// <param name="aid"></param>
/// <param name="groupId"></param>
/// <param name="BranchId"></param>
/// <returns></returns>
public
bool
ValidateName
(
int
aid
,
int
groupId
,
int
BranchId
)
{
return
respository
.
ValidateName
(
aid
,
groupId
,
BranchId
);
}
/// <summary>
/// 新增修改
/// </summary>
/// <param name="attendanceId"></param>
/// <param name="Status"></param>
/// <param name="BranchId"></param>
/// <param name="WorkDayList"></param>
/// <param name="ClockDateList"></param>
/// <param name="NotClockDateList"></param>
/// <param name="AddressWayList"></param>
/// <param name="WifiWayList"></param>
/// <param name="eid"></param>
/// <param name="groupId"></param>
/// <returns></returns>
public
bool
Set
(
int
attendanceId
,
int
Status
,
int
BranchId
,
List
<
RB_WorkdaySeting_Extend
>
WorkDayList
,
List
<
RB_Technicaldates_Extend
>
ClockDateList
,
List
<
RB_Technicaldates_Extend
>
NotClockDateList
,
List
<
RB_Attendance_Way_Extend
>
AddressWayList
,
List
<
RB_Attendance_Way_Extend
>
WifiWayList
,
int
eid
,
int
groupId
)
{
var
trans
=
respository
.
DbTransaction
;
try
{
if
(
attendanceId
>
0
)
//修改
{
#
region
修改
RB_Attendance
amodel
=
respository
.
GetEntity
(
attendanceId
);
amodel
.
Status
=
Status
;
amodel
.
UpdateBy
=
eid
;
amodel
.
UpdateTime
=
DateTime
.
Now
;
bool
flag
=
respository
.
Update
(
amodel
,
trans
);
if
(
flag
)
{
//删除全部的工作日数据
respository
.
DelAllList
(
attendanceId
,
trans
);
foreach
(
var
item
in
WorkDayList
)
{
//获取单条工作日数据
RB_WorkdaySeting_Extend
wmodel
=
new
RB_WorkdaySeting_Extend
{
AttendanceId
=
attendanceId
,
Workday
=
item
.
Workday
,
BeOnDutyTime
=
item
.
BeOnDutyTime
,
OffDutyTime
=
item
.
OffDutyTime
};
WDrespository
.
Insert
(
wmodel
,
trans
);
}
foreach
(
var
item
in
ClockDateList
)
{
//获取特殊日期 需打卡
RB_Technicaldates
tdmodel
=
new
RB_Technicaldates
{
AttendanceId
=
attendanceId
,
Date
=
Convert
.
ToDateTime
(
item
.
Date
),
BeOnDutyTime
=
item
.
BeOnDutyTime
,
OffDutyTime
=
item
.
OffDutyTime
,
Type
=
1
,
RB_Department_Id
=
item
.
RB_Department_Id
,
//2019-09-23 Add By:W 可设置某一个部门或者人打卡
EmployeeId
=
item
.
EmployeeId
//2019-09-23 Add By:W
};
TDrespository
.
Insert
(
tdmodel
,
trans
);
}
foreach
(
var
item
in
NotClockDateList
)
{
//获取特殊日期 无需打卡
RB_Technicaldates
tdmodel
=
new
RB_Technicaldates
{
AttendanceId
=
attendanceId
,
Date
=
Convert
.
ToDateTime
(
item
.
Date
),
Type
=
2
,
RB_Department_Id
=
item
.
RB_Department_Id
,
//2019-09-23 Add By:W
EmployeeId
=
item
.
EmployeeId
//2019-09-23 Add By:W
};
TDrespository
.
Insert
(
tdmodel
,
trans
);
}
foreach
(
var
item
in
AddressWayList
)
{
//1.根据办公地点考勤(可添加多个考勤地点)
RB_Attendance_Way
wdmodel
=
new
RB_Attendance_Way
{
Attendance_Id
=
attendanceId
,
Type
=
1
,
Name
=
item
.
Name
,
Address
=
item
.
Address
,
TargetAddress
=
item
.
TargetAddress
,
Scope
=
item
.
Scope
??
0
};
AWrespository
.
Insert
(
wdmodel
,
trans
);
}
foreach
(
var
item
in
WifiWayList
)
{
//2.根据WiFi考勤
RB_Attendance_Way
wdmodel
=
new
RB_Attendance_Way
{
Attendance_Id
=
attendanceId
,
Type
=
2
,
Name
=
item
.
Name
,
TargetAddress
=
item
.
TargetAddress
};
AWrespository
.
Insert
(
wdmodel
,
trans
);
}
}
#
endregion
}
else
{
//新增
#
region
新增
RB_Attendance_Extend
amodel
=
new
RB_Attendance_Extend
{
RB_BranchId
=
BranchId
,
RB_GroupId
=
groupId
,
Status
=
Status
,
CreateBy
=
eid
,
CreateTime
=
DateTime
.
Now
,
UpdateBy
=
eid
,
UpdateTime
=
DateTime
.
Now
};
int
aid
=
respository
.
Insert
(
amodel
,
trans
);
if
(
aid
>
0
)
{
foreach
(
var
item
in
WorkDayList
)
{
//获取单条工作日数据
RB_WorkdaySeting
wmodel
=
new
RB_WorkdaySeting
{
AttendanceId
=
aid
,
Workday
=
item
.
Workday
,
BeOnDutyTime
=
item
.
BeOnDutyTime
,
OffDutyTime
=
item
.
OffDutyTime
};
WDrespository
.
Insert
(
wmodel
,
trans
);
}
foreach
(
var
item
in
ClockDateList
)
{
//获取特殊日期 需打卡
RB_Technicaldates
tdmodel
=
new
RB_Technicaldates
{
AttendanceId
=
aid
,
Date
=
Convert
.
ToDateTime
(
item
.
Date
),
BeOnDutyTime
=
item
.
BeOnDutyTime
,
OffDutyTime
=
item
.
OffDutyTime
,
Type
=
1
,
RB_Department_Id
=
item
.
RB_Department_Id
,
//2019-09-23 Add By:W 可设置某一个部门或者人打卡
EmployeeId
=
item
.
EmployeeId
//2019-09-23 Add By:W
};
TDrespository
.
Insert
(
tdmodel
,
trans
);
}
foreach
(
var
item
in
NotClockDateList
)
{
//获取特殊日期 无需打卡
RB_Technicaldates
tdmodel
=
new
RB_Technicaldates
{
AttendanceId
=
aid
,
Date
=
Convert
.
ToDateTime
(
item
.
Date
),
Type
=
2
,
RB_Department_Id
=
item
.
RB_Department_Id
,
//2019-09-23 Add By:W 可设置某一个部门或者人打卡
EmployeeId
=
item
.
EmployeeId
//2019-09-23 Add By:W
};
TDrespository
.
Insert
(
tdmodel
,
trans
);
}
foreach
(
var
item
in
AddressWayList
)
{
//1.根据办公地点考勤(可添加多个考勤地点)
RB_Attendance_Way
wdmodel
=
new
RB_Attendance_Way
{
Attendance_Id
=
aid
,
Type
=
1
,
Name
=
item
.
Name
,
Address
=
item
.
Address
,
TargetAddress
=
item
.
TargetAddress
,
Scope
=
item
.
Scope
??
0
};
AWrespository
.
Insert
(
wdmodel
,
trans
);
}
foreach
(
var
item
in
WifiWayList
)
{
//2.根据WiFi考勤
RB_Attendance_Way
wdmodel
=
new
RB_Attendance_Way
{
Attendance_Id
=
aid
,
Type
=
2
,
Name
=
item
.
Name
,
TargetAddress
=
item
.
TargetAddress
};
AWrespository
.
Insert
(
wdmodel
,
trans
);
}
}
#
endregion
}
respository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"AttendanceModule_Set"
);
respository
.
DBSession
.
Rollback
(
"AttendanceModule_Set"
);
return
false
;
}
return
true
;
}
/// <summary>
/// 获取每日打卡记录
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="RB_Group_id"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetEveryDayAttendanceRecordList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
string
StartTime
,
string
EndTime
,
int
eid
,
int
bid
,
int
DepartmentId
,
int
RB_Group_id
)
{
return
respository
.
GetEveryDayAttendanceRecordList
(
pageIndex
,
pageSize
,
out
count
,
StartTime
,
EndTime
,
eid
,
bid
,
DepartmentId
,
RB_Group_id
);
}
/// <summary>
/// 获取原始记录
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="RB_Group_id"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetOriginalRecordList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
string
StartTime
,
string
EndTime
,
int
eid
,
int
bid
,
int
DepartmentId
,
int
RB_Group_id
)
{
return
respository
.
GetOriginalRecordList
(
pageIndex
,
pageSize
,
out
count
,
StartTime
,
EndTime
,
eid
,
bid
,
DepartmentId
,
RB_Group_id
);
}
/// <summary>
///
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="EmIdStr"></param>
/// <param name="RB_Group_id"></param>
/// <param name="IsLeader"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetClockTimeRecordList
(
string
StartTime
,
string
EndTime
,
int
eid
,
int
bid
,
int
DepartmentId
,
string
EmIdStr
,
int
RB_Group_id
,
int
IsLeader
=
1
)
{
return
respository
.
GetClockTimeRecordList
(
StartTime
,
EndTime
,
eid
,
bid
,
DepartmentId
,
EmIdStr
,
RB_Group_id
,
IsLeader
);
}
/// <summary>
/// 月度统计请假时长详情
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="AskLeaveType"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Askforleave_Extend
>
GetAskLeaveInfo
(
string
StartTime
,
string
EndTime
,
int
eid
,
int
AskLeaveType
)
{
return
AskforleaveRepository
.
GetAskLeaveInfo
(
StartTime
,
EndTime
,
eid
,
AskLeaveType
);
}
/// <summary>
/// 获取打卡时间内的所有用户
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="RB_Group_id"></param>
/// <returns></returns>
public
List
<
RB_Employee_Extend
>
GetClockTimeEmployeeList
(
string
StartTime
,
string
EndTime
,
int
pageIndex
,
int
pageSize
,
out
long
count
,
int
eid
,
int
bid
,
int
DepartmentId
,
int
RB_Group_id
)
{
return
respository
.
GetClockTimeEmployeeList
(
StartTime
,
EndTime
,
pageIndex
,
pageSize
,
out
count
,
eid
,
bid
,
DepartmentId
,
RB_Group_id
);
}
/// <summary>
/// 获取每月统计
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="RB_Group_id"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetMonthRecordList
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
string
StartTime
,
string
EndTime
,
int
eid
,
int
bid
,
int
DepartmentId
,
int
RB_Group_id
)
{
return
respository
.
GetMonthRecordList
(
pageIndex
,
pageSize
,
out
count
,
StartTime
,
EndTime
,
eid
,
bid
,
DepartmentId
,
RB_Group_id
);
}
/// <summary>
/// 四川和平专用 统计每月打卡
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="bid"></param>
/// <param name="DepartmentId"></param>
/// <param name="RB_Group_id"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetMonthRecordListForHPZY
(
int
pageIndex
,
int
pageSize
,
out
long
count
,
string
StartTime
,
string
EndTime
,
int
eid
,
int
bid
,
int
DepartmentId
,
int
RB_Group_id
)
{
var
list
=
dictvalueRepository
.
GetList
(
new
RB_Dictvalue_Extend
()
{
RB_Group_id
=
RB_Group_id
,
DictKey
=
"SK_BeLateSet_Level"
});
var
model
=
list
.
FirstOrDefault
();
string
Time
=
model
?.
Content
;
if
(
string
.
IsNullOrWhiteSpace
(
Time
))
{
Time
=
"10"
;
}
return
respository
.
GetMonthRecordListForHPZY
(
pageIndex
,
pageSize
,
out
count
,
StartTime
,
EndTime
,
eid
,
bid
,
DepartmentId
,
RB_Group_id
,
Time
);
}
/// <summary>
/// 获取每月统计 单个状态数据
/// </summary>
/// <param name="StartTime"></param>
/// <param name="EndTime"></param>
/// <param name="eid"></param>
/// <param name="status"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Record_Extend
>
GetRecordForStatusList
(
string
StartTime
,
string
EndTime
,
int
eid
,
int
status
)
{
return
respository
.
GetRecordForStatusList
(
StartTime
,
EndTime
,
eid
,
status
);
}
/// <summary>
/// 获取该员工所在公司是否开启考勤
/// </summary>
/// <param name="groupId"></param>
/// <param name="branchId"></param>
/// <returns></returns>
public
int
IsAttendanceForBranch
(
int
groupId
,
int
branchId
)
{
return
respository
.
IsAttendanceForBranch
(
groupId
,
branchId
);
}
/// <summary>
/// 根据考勤id获取考勤方式
/// </summary>
/// <param name="aid"></param>
/// <returns></returns>
public
List
<
RB_Attendance_Way_Extend
>
GetAttendanceWay
(
int
aid
)
{
return
respository
.
GetAttendanceWay
(
aid
);
}
/// <summary>
/// 获取当前记录的上下班时间
/// </summary>
/// <param name="empId"></param>
/// <param name="currentDate"></param>
/// <returns></returns>
public
string
GetBeOnOffTime
(
int
empId
,
DateTime
currentDate
)
{
string
BeOnOffTime
=
""
;
//获取特殊日期
List
<
RB_Technicaldates_Extend
>
technicalList
=
technicaldatesRepository
.
GetSpecialDateList
(
empId
);
//正常打卡日期
List
<
RB_WorkdaySeting_Extend
>
workDayList
=
workdaysetingRepository
.
GetWorkDayList
(
empId
);
RB_Technicaldates_Extend
technical
=
technicalList
.
Where
(
t
=>
t
.
Date
.
Date
==
currentDate
.
Date
).
FirstOrDefault
();
if
(
technical
!=
null
)
//特殊日期
{
#
region
特殊日期
//当天上班时间
DateTime
onDateTime
=
Convert
.
ToDateTime
(
$"
{
technical
.
Date
.
Year
}
-
{
technical
.
Date
.
Month
}
-
{
technical
.
Date
.
Day
}
{
Convert
.
ToDateTime
(
technical
.
BeOnDutyTime
).
Hour
}
:
{
Convert
.
ToDateTime
(
technical
.
BeOnDutyTime
).
Minute
}
:
{
Convert
.
ToDateTime
(
technical
.
BeOnDutyTime
).
Second
}
"
);
//当天下班时间
DateTime
offDateTime
=
Convert
.
ToDateTime
(
$"
{
technical
.
Date
.
Year
}
-
{
technical
.
Date
.
Month
}
-
{
technical
.
Date
.
Day
}
{
Convert
.
ToDateTime
(
technical
.
OffDutyTime
).
Hour
}
:
{
Convert
.
ToDateTime
(
technical
.
OffDutyTime
).
Minute
}
:
{
Convert
.
ToDateTime
(
technical
.
OffDutyTime
).
Second
}
"
);
#
endregion
BeOnOffTime
=
"{\"BeOnTime\":\""
+
onDateTime
.
ToString
(
"HH:mm"
)
+
"\",\"OffTime\":\""
+
offDateTime
.
ToString
(
"HH:mm"
)
+
"\"}"
;
}
else
{
RB_WorkdaySeting_Extend
workDay
=
workDayList
.
Where
(
t
=>
t
.
Workday
==
StringHelper
.
GetWeek
(
currentDate
.
Date
)).
FirstOrDefault
();
if
(
workDay
!=
null
)
{
#
region
正常日期
//当天上班时间
DateTime
onDateTime
=
Convert
.
ToDateTime
(
$"
{
currentDate
.
Date
.
Year
}
-
{
currentDate
.
Date
.
Month
}
-
{
currentDate
.
Date
.
Day
}
{
Convert
.
ToDateTime
(
workDay
.
BeOnDutyTime
).
Hour
}
:
{
Convert
.
ToDateTime
(
workDay
.
BeOnDutyTime
).
Minute
}
:
{
Convert
.
ToDateTime
(
workDay
.
BeOnDutyTime
).
Second
}
"
);
//当天下班时间
DateTime
offDateTime
=
Convert
.
ToDateTime
(
$"
{
currentDate
.
Date
.
Year
}
-
{
currentDate
.
Date
.
Month
}
-
{
currentDate
.
Date
.
Day
}
{
Convert
.
ToDateTime
(
workDay
.
OffDutyTime
).
Hour
}
:
{
Convert
.
ToDateTime
(
workDay
.
OffDutyTime
).
Minute
}
:
{
Convert
.
ToDateTime
(
workDay
.
OffDutyTime
).
Second
}
"
);
#
endregion
BeOnOffTime
=
"{\"BeOnTime\":\""
+
onDateTime
.
ToString
(
"HH:mm"
)
+
"\",\"OffTime\":\""
+
offDateTime
.
ToString
(
"HH:mm"
)
+
"\"}"
;
}
}
return
BeOnOffTime
;
}
/// <summary>
/// 更正缺卡
/// </summary>
/// <param name="RecordId"></param>
/// <param name="OnAndOffDuty"></param>
/// <param name="RecordStatus"></param>
/// <param name="BeLateTime"></param>
/// <param name="DKTime"></param>
/// <param name="SBTime"></param>
/// <returns></returns>
public
bool
SetDayRecord
(
int
RecordId
,
int
OnAndOffDuty
,
int
RecordStatus
,
string
BeLateTime
,
string
DKTime
,
string
SBTime
)
{
var
model
=
RecordRepository
.
GetEntity
(
RecordId
);
if
(
OnAndOffDuty
==
1
)
//上班
{
if
(
model
.
BeOnStatus
!=
AttendanceEnum
.
QK
)
{
return
false
;
}
if
(
RecordStatus
==
1
)
//正常
{
model
.
BeOnStatus
=
AttendanceEnum
.
ZC
;
model
.
BeOnAddress
=
"管理员改为正常"
;
}
else
{
//迟到
model
.
BeOnStatus
=
AttendanceEnum
.
CD
;
model
.
BeLateTime
=
Convert
.
ToInt32
(
BeLateTime
);
model
.
BeOnAddress
=
"管理员改为迟到"
;
}
model
.
BeOnDutyTime
=
Convert
.
ToDateTime
(
DKTime
+
" "
+
SBTime
).
AddMinutes
(
Convert
.
ToDouble
(
BeLateTime
));
model
.
BeOnTime
=
SBTime
;
}
else
{
//下班
if
(
model
.
OffStatus
!=
AttendanceEnum
.
QK
)
{
return
false
;
}
if
(
RecordStatus
==
1
)
//正常
{
model
.
OffStatus
=
AttendanceEnum
.
ZC
;
model
.
OffDutyTime
=
Convert
.
ToDateTime
(
DKTime
+
" "
+
SBTime
).
AddMinutes
(
Convert
.
ToDouble
(
BeLateTime
));
model
.
OffTime
=
SBTime
;
model
.
OffAddress
=
"管理员改为正常"
;
}
}
return
RecordRepository
.
Update
(
model
);
}
}
}
Edu.Module.User/NoticeModule.cs
0 → 100644
View file @
0269469c
using
Edu.Common.API
;
using
Edu.Common.Plugin
;
using
Edu.Model.CacheModel
;
using
Edu.Model.Entity.User
;
using
Edu.Model.Public
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Edu.Module.User
{
/// <summary>
/// 公告处理类
/// </summary>
public
class
NoticeModule
{
/// <summary>
/// 公告处理类对象
/// </summary>
private
readonly
RB_NoticeRepository
noticeRepository
=
new
RB_NoticeRepository
();
/// <summary>
/// 公告基础
/// </summary>
private
readonly
RB_Notice_BaseRepository
notice_BaseRepository
=
new
RB_Notice_BaseRepository
();
/// <summary>
/// 公告阅读
/// </summary>
private
readonly
RB_Notice_ReadRepository
notice_ReadRepository
=
new
RB_Notice_ReadRepository
();
/// <summary>
/// 部门
/// </summary>
private
readonly
RB_DepartmentRepository
departmentRepository
=
new
RB_DepartmentRepository
();
/// <summary>
/// 账号
/// </summary>
private
readonly
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 获取公告配置信息
/// </summary>
/// <param name="group_Id"></param>
/// <returns></returns>
public
object
GetNoticeBaseInfo
(
int
group_Id
)
{
var
model
=
notice_BaseRepository
.
GetList
(
new
RB_Notice_Base_ViewModel
()
{
Group_Id
=
group_Id
}).
FirstOrDefault
();
return
new
{
model
?.
Id
,
model
?.
Image
,
model
?.
From
,
model
?.
NumberRule
,
NumberRuleName
=
model
?.
NumberRule
.
ToName
(),
model
?.
CopyPeople
};
}
/// <summary>
/// 新增修改 公告配置信息
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
string
SetNoticeBaseInfo
(
RB_Notice_Base_ViewModel
dmodel
)
{
bool
flag
;
if
(
dmodel
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Notice_Base
.
Image
),
dmodel
.
Image
},
{
nameof
(
RB_Notice_Base
.
CopyPeople
),
dmodel
.
CopyPeople
},
{
nameof
(
RB_Notice_Base
.
From
),
dmodel
.
From
},
{
nameof
(
RB_Notice_Base
.
NumberRule
),
dmodel
.
NumberRule
},
{
nameof
(
RB_Notice_Base
.
UpdateBy
),
dmodel
.
UpdateBy
},
{
nameof
(
RB_Notice_Base
.
UpdateTime
),
DateTime
.
Now
},
};
List
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Notice_Base
.
Id
),
FiledValue
=
dmodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
notice_BaseRepository
.
Update
(
keyValues
,
whereHelpers
);
}
else
{
var
model
=
notice_BaseRepository
.
GetList
(
new
RB_Notice_Base_ViewModel
()
{
Group_Id
=
dmodel
.
Group_Id
}).
FirstOrDefault
();
if
(
model
==
null
)
{
flag
=
notice_BaseRepository
.
Insert
(
dmodel
)
>
0
;
}
else
{
return
"已存在配置,无法新增"
;
}
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
/// <summary>
/// 获取公告分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public
List
<
RB_Notice_ViewModel
>
GetNoticePageList
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Notice_ViewModel
dmodel
)
{
var
list
=
noticeRepository
.
GetPageList
(
pageIndex
,
pageSize
,
out
rowsCount
,
dmodel
);
if
(
list
.
Any
())
{
//查询阅读人数
string
NoticeIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
var
readList
=
notice_ReadRepository
.
GetNoticeReadNumList
(
NoticeIds
);
foreach
(
var
item
in
list
)
{
item
.
ReadNum
=
readList
.
Where
(
x
=>
x
.
NoticeId
==
item
.
Id
).
FirstOrDefault
()?.
ReadNum
??
0
;
}
}
return
list
;
}
/// <summary>
/// 获取公告信息
/// </summary>
/// <param name="noticeId"></param>
/// <returns></returns>
public
ApiResult
GetNoticeInfo
(
int
noticeId
)
{
var
model
=
noticeRepository
.
GetEntity
<
RB_Notice_ViewModel
>(
noticeId
);
if
(
model
==
null
)
{
return
ApiResult
.
ParamIsNull
();
}
List
<
object
>
DepartmentList
=
new
List
<
object
>()
{
new
{
DepartmentId
=
-
1
,
DeptName
=
"全公司"
}
};
if
(!
string
.
IsNullOrEmpty
(
model
.
To
)
&&
model
.
To
!=
"-1"
)
{
//查询所有的部门
var
dlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
RB_Department_ViewModel
()
{
Group_Id
=
model
.
Group_Id
,
QDeptIds
=
model
.
To
});
DepartmentList
=
new
List
<
object
>();
foreach
(
var
item
in
dlist
)
{
DepartmentList
.
Add
(
new
{
DepartmentId
=
item
.
DeptId
,
item
.
DeptName
});
}
}
List
<
object
>
CopyPeopleList
=
new
List
<
object
>();
if
(!
string
.
IsNullOrEmpty
(
model
.
CopyPeople
))
{
//查询所有人
var
elist
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
Group_Id
=
model
.
Group_Id
,
QIds
=
model
.
CopyPeople
});
foreach
(
var
item
in
elist
)
{
CopyPeopleList
.
Add
(
new
{
EmployeeId
=
item
.
Id
,
EmName
=
item
.
EmployeeName
});
}
}
//转换文件列表
model
.
FileList
=
new
List
<
FileModel
>();
if
(!
string
.
IsNullOrEmpty
(
model
.
File
))
{
model
.
FileList
=
JsonHelper
.
DeserializeObject
<
List
<
FileModel
>>(
model
.
File
);
}
return
ApiResult
.
Success
(
""
,
new
{
model
.
Id
,
model
.
From
,
model
.
To
,
DepartmentList
,
model
.
CopyPeople
,
CopyPeopleList
,
model
.
Number
,
model
.
Title
,
model
.
Content
,
FileList
=
model
.
FileList
.
Select
(
x
=>
new
{
x
.
FileName
,
x
.
FileUrl
}),
model
.
NoticeState
,
NoticeStateName
=
model
.
NoticeState
.
ToName
(),
model
.
Is_Top
,
model
.
UpdateBy
,
UpdateTime
=
model
.
UpdateTime
.
HasValue
?
model
.
UpdateTime
.
Value
.
ToString
(
"yyyy-MM-dd"
)
:
""
});
}
/// <summary>
/// 公告操作
/// </summary>
/// <param name="noticeId"></param>
/// <param name="type">类型 1置顶 2取消置顶 3撤回 4删除</param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
bool
SetNoticeOperation
(
int
noticeId
,
int
type
,
UserInfo
userInfo
)
{
if
(
type
==
5
)
{
//公告阅读
//查询该人是否已阅读
var
readModel
=
notice_ReadRepository
.
GetList
(
new
RB_Notice_Read_ViewModel
()
{
NoticeId
=
noticeId
,
AccountId
=
userInfo
.
Id
}).
FirstOrDefault
();
if
(
readModel
==
null
)
{
return
notice_ReadRepository
.
Insert
(
new
RB_Notice_Read
()
{
Id
=
0
,
AccountId
=
userInfo
.
Id
,
NoticeId
=
noticeId
,
ReadTime
=
DateTime
.
Now
})
>
0
;
}
else
{
return
true
;
}
}
else
{
var
model
=
noticeRepository
.
GetEntity
(
noticeId
);
if
(
type
==
3
)
{
if
(
model
.
NoticeState
!=
Common
.
Enum
.
User
.
NoticeStateEnum
.
Publish
)
{
return
false
;
}
}
if
(
type
==
4
)
{
if
(
model
.
NoticeState
==
Common
.
Enum
.
User
.
NoticeStateEnum
.
Publish
)
{
return
false
;
}
}
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Notice
.
UpdateBy
),
userInfo
.
Id
},
{
nameof
(
RB_Notice
.
UpdateTime
),
DateTime
.
Now
},
};
if
(
type
==
1
)
{
keyValues
.
Add
(
nameof
(
RB_Notice
.
Is_Top
),
1
);
}
else
if
(
type
==
2
)
{
keyValues
.
Add
(
nameof
(
RB_Notice
.
Is_Top
),
2
);
}
else
if
(
type
==
3
)
{
keyValues
.
Add
(
nameof
(
RB_Notice
.
NoticeState
),
Common
.
Enum
.
User
.
NoticeStateEnum
.
Cancel
);
}
else
if
(
type
==
4
)
{
keyValues
.
Add
(
nameof
(
RB_Notice
.
Status
),
Common
.
Enum
.
DateStateEnum
.
Delete
);
}
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Notice
.
Id
),
FiledValue
=
noticeId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
return
noticeRepository
.
Update
(
keyValues
,
wheres
);
}
}
/// <summary>
/// 新增修改公告
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public
bool
SetNoticeInfo
(
RB_Notice_ViewModel
demodel
)
{
if
(
demodel
.
Id
>
0
)
{
var
oldModel
=
noticeRepository
.
GetEntity
(
demodel
.
Id
);
Dictionary
<
string
,
object
>
keyValues
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Notice
.
From
),
demodel
.
From
},
{
nameof
(
RB_Notice
.
To
),
demodel
.
To
},
{
nameof
(
RB_Notice
.
CopyPeople
),
demodel
.
CopyPeople
},
{
nameof
(
RB_Notice
.
Title
),
demodel
.
Title
},
{
nameof
(
RB_Notice
.
Content
),
demodel
.
Content
},
{
nameof
(
RB_Notice
.
File
),
demodel
.
File
},
{
nameof
(
RB_Notice
.
NoticeState
),
demodel
.
NoticeState
},
{
nameof
(
RB_Notice
.
Is_Top
),
demodel
.
Is_Top
},
{
nameof
(
RB_Notice
.
UpdateBy
),
demodel
.
UpdateBy
},
{
nameof
(
RB_Notice
.
UpdateTime
),
demodel
.
UpdateTime
}
};
List
<
WhereHelper
>
wheres
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(){
FiledName
=
nameof
(
RB_Notice
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
noticeRepository
.
Update
(
keyValues
,
wheres
);
if
(
flag
&&
oldModel
.
NoticeState
==
Common
.
Enum
.
User
.
NoticeStateEnum
.
Draft
&&
demodel
.
NoticeState
==
Common
.
Enum
.
User
.
NoticeStateEnum
.
Publish
)
{
//推送消息
}
return
flag
;
}
else
{
//查询生成规则
var
model
=
notice_BaseRepository
.
GetList
(
new
RB_Notice_Base_ViewModel
()
{
Group_Id
=
demodel
.
Group_Id
}).
FirstOrDefault
();
if
(
model
==
null
)
{
return
false
;
}
demodel
.
Number
=
""
;
demodel
.
NumberRule
=
model
.
NumberRule
;
if
(
model
.
NumberRule
==
Common
.
Enum
.
User
.
NoticeRuleEnum
.
One
)
{
//求出当前规则的最大一个
string
MaxNumber
=
noticeRepository
.
GetNoticeNumberMax
(
model
.
NumberRule
,
demodel
.
Group_Id
);
if
(!
string
.
IsNullOrEmpty
(
MaxNumber
))
{
string
[]
NumberArr
=
MaxNumber
.
Split
(
'-'
);
string
Letter
=
NumberArr
[
1
];
int
Num
=
Convert
.
ToInt32
(
NumberArr
[
2
]);
if
(
Num
>=
999
)
{
string
LetterStr
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
;
int
Index
=
LetterStr
.
IndexOf
(
LetterStr
);
Letter
=
LetterStr
.
Substring
(
Index
,
Index
+
1
);
Num
=
1
;
}
else
{
Num
++;
}
demodel
.
Number
=
DateTime
.
Now
.
ToString
(
"yyyy"
)
+
"-"
+
Letter
+
"-"
+
Num
.
ToString
().
PadLeft
(
3
,
'0'
);
}
else
{
demodel
.
Number
=
DateTime
.
Now
.
ToString
(
"yyyy"
)
+
"-A-001"
;
}
}
bool
flag
=
noticeRepository
.
Insert
(
demodel
)
>
0
;
if
(
flag
&&
demodel
.
NoticeState
==
Common
.
Enum
.
User
.
NoticeStateEnum
.
Publish
)
{
//推送消息
}
return
flag
;
}
}
}
}
Edu.Module.User/WorkFlowManagementModule.cs
0 → 100644
View file @
0269469c
using
Edu.Common.API
;
using
Edu.Common.Enum.User
;
using
Edu.Common.Plugin
;
using
Edu.Model.CacheModel
;
using
Edu.Model.Entity.User
;
using
Edu.Model.Public
;
using
Edu.Model.ViewModel.User
;
using
Edu.Repository.User
;
using
Newtonsoft.Json
;
using
System
;
using
System.Collections.Generic
;
using
System.Data
;
using
System.Linq
;
using
System.Text
;
using
VT.FW.DB
;
namespace
Edu.Module.User
{
/// <summary>
/// 流程管理处理类
/// </summary>
public
class
WorkFlowManagementModule
{
private
Rb_Workflow_TemplateRepository
respository
=
new
Rb_Workflow_TemplateRepository
();
private
Rb_Workflow_AuditRepository
respositoryAudit
=
new
Rb_Workflow_AuditRepository
();
private
Rb_Workflow_AuditUserRepository
respositoryUser
=
new
Rb_Workflow_AuditUserRepository
();
private
Rb_Workflow_ConditionRepository
respositoryCondition
=
new
Rb_Workflow_ConditionRepository
();
private
Rb_Workflow_AskforleaveRepository
respositoryAskforleave
=
new
Rb_Workflow_AskforleaveRepository
();
private
Rb_Workflow_EvectionRepository
respositoryEvection
=
new
Rb_Workflow_EvectionRepository
();
private
Rb_Workflow_GoOutRepository
respositoryGoout
=
new
Rb_Workflow_GoOutRepository
();
private
Rb_Workflow_ReissuecardRepository
respositoryReissuecar
=
new
Rb_Workflow_ReissuecardRepository
();
private
Rb_Workflow_VisualrangeRepository
visualrangeRepository
=
new
Rb_Workflow_VisualrangeRepository
();
private
RB_AccountRepository
accountRepository
=
new
RB_AccountRepository
();
/// <summary>
/// 获取所有数据
/// </summary>
/// <returns></returns>
public
List
<
Rb_Workflow_Template
>
GetTemplateList
(
UserInfo
userInfo
)
{
return
respository
.
GetTempateList
(
userInfo
.
Group_Id
,
userInfo
.
School_Id
);
}
/// <summary>
/// 根据id获取数据
/// </summary>
/// <param name="tid"></param>
/// <returns></returns>
public
Rb_Workflow_Template
GetTemplate
(
int
tid
)
{
var
model
=
respository
.
GetEntity
(
tid
);
return
model
;
}
/// <summary>
/// 保存修改模版
/// </summary>
/// <param name="demodel"></param>
/// <param name="GroupId"></param>
/// <param name="BranchId"></param>
/// <param name="eid"></param>
/// <returns></returns>
public
bool
SetTemplate
(
Rb_Workflow_Template
demodel
,
int
GroupId
,
int
BranchId
,
int
eid
)
{
bool
flag
=
false
;
if
(
demodel
.
Id
>
0
)
//修改
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>
{
{
nameof
(
RB_Department
.
Status
),
demodel
.
Status
},
{
nameof
(
RB_Department
.
UpdateBy
),
eid
},
{
nameof
(
RB_Department
.
UpdateTime
),
DateTime
.
Now
}
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>
{
new
WhereHelper
()
{
FiledName
=
nameof
(
Rb_Workflow_Template
.
Id
),
FiledValue
=
demodel
.
Id
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
flag
=
respository
.
Update
(
fileds
,
whereHelpers
);
}
else
{
//新增
demodel
.
AuditDistinct
=
1
;
demodel
.
CreateBy
=
eid
;
demodel
.
CreateTime
=
DateTime
.
Now
;
string
[]
Ttype
=
Common
.
Plugin
.
EnumHelper
.
ToName
(
demodel
.
TemplateType
).
Split
(
'|'
);
demodel
.
Icon
=
Ttype
[
1
];
demodel
.
Name
=
Ttype
[
0
];
demodel
.
GroupType
=
(
WFTGroupTypeEnum
)
Convert
.
ToInt32
(
Ttype
[
2
]);
demodel
.
NotificationCP
=
1
;
demodel
.
RB_BranchId
=
BranchId
;
demodel
.
RB_GroupId
=
GroupId
;
demodel
.
Status
=
1
;
demodel
.
UpdateBy
=
eid
;
demodel
.
UpdateTime
=
DateTime
.
Now
;
demodel
.
Type
=
(
int
)
WFTempTypeEnum
.
OA
;
int
tid
=
respository
.
Insert
(
demodel
);
if
(
tid
>
0
)
flag
=
true
;
}
return
flag
;
}
/// <summary>
/// 获取默认审核人
/// </summary>
/// <param name="TemplateId"></param>
/// <returns></returns>
public
Rb_Workflow_Condition_Extend
GetDefaultCondition
(
int
TemplateId
)
{
var
list
=
respositoryCondition
.
GetDefaultCondition
(
TemplateId
);
var
tmodel
=
respository
.
GetEntity
(
TemplateId
);
int
TemplateType
=
1
;
string
TemplateTypeName
=
""
;
if
(
tmodel
!=
null
)
{
TemplateType
=
(
int
)
tmodel
.
TemplateType
;
TemplateTypeName
=
tmodel
.
Name
;
}
if
(
list
.
Count
>
0
)
{
var
model
=
list
[
0
];
model
.
Description
=
""
;
List
<
Rb_Workflow_Audit_Extend
>
alist
=
respositoryAudit
.
GetDefaultAudit
(
model
.
Id
);
foreach
(
var
item
in
alist
)
{
if
(
item
.
AuditType
==
2
)
item
.
AuditUserList
=
respositoryUser
.
GetConditionAuditUser
(
item
.
Id
);
}
model
.
AuditList
=
alist
;
List
<
Rb_Workflow_Audituser_Extend
>
ulist
=
respositoryUser
.
GetDefaultAuditUser
(
model
.
Id
);
model
.
AuditUserList
=
ulist
;
model
.
TemplateType
=
TemplateType
;
model
.
TemplateTypeName
=
TemplateTypeName
;
return
model
;
}
else
{
return
new
Rb_Workflow_Condition_Extend
()
{
TemplateId
=
TemplateId
,
Sort
=
0
,
Id
=
0
,
TemplateType
=
TemplateType
,
TemplateTypeName
=
TemplateTypeName
};
}
}
/// <summary>
/// 获取分条建审核
/// </summary>
/// <param name="TemplateId"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Condition_Extend
>
GetOtherConditionList
(
int
TemplateId
)
{
var
list
=
respositoryCondition
.
GetOtherConditionList
(
TemplateId
);
List
<
Rb_Workflow_Audit_Extend
>
alist
=
respositoryAudit
.
GetAllAudit
(
TemplateId
);
List
<
Rb_Workflow_Audituser_Extend
>
ulist
=
respositoryUser
.
GetAllAuditUser
(
TemplateId
);
var
tmodel
=
respository
.
GetEntity
(
TemplateId
);
foreach
(
var
model
in
list
)
{
string
description
=
"如果"
;
if
(
tmodel
.
TemplateType
==
WFTTemplateTypeEnum
.
AskForLeave
)
{
description
=
"请假类型属于:"
;
List
<
int
>
aflStr
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
model
.
AskforleaveType
);
string
askType
=
""
;
foreach
(
int
afl
in
aflStr
)
{
askType
+=
Common
.
Plugin
.
EnumHelper
.
ToName
((
AskforleaveTypeEnum
)
afl
)
+
"、"
;
}
if
(
askType
!=
""
)
{
description
=
description
+
askType
.
Substring
(
0
,
askType
.
Length
-
1
);
}
description
+=
" 并且 "
;
}
//string dayOrHours = model.DayHour == 1 ? "时长(天数)" : "时长(小时)";
string
dayOrHours
=
"时长(小时)"
;
if
(
tmodel
!=
null
&&
tmodel
.
TemplateType
==
WFTTemplateTypeEnum
.
Evection
)
{
dayOrHours
=
"时长(天数)"
;
}
switch
(
model
.
ConditionType
)
{
case
(
int
)
EquationTypeEnum
.
LessThan
:
description
+=
dayOrHours
+
"<"
+
model
.
StartValue
;
break
;
case
(
int
)
EquationTypeEnum
.
GreaterThan
:
description
+=
dayOrHours
+
">"
+
model
.
StartValue
;
break
;
case
(
int
)
EquationTypeEnum
.
EqualTo
:
description
+=
dayOrHours
+
"="
+
model
.
StartValue
;
break
;
case
(
int
)
EquationTypeEnum
.
LessThanOrEqualTo
:
description
+=
dayOrHours
+
"≤"
+
model
.
StartValue
;
break
;
case
(
int
)
EquationTypeEnum
.
GreaterThanOrEqualTo
:
description
+=
dayOrHours
+
"≥"
+
model
.
StartValue
;
break
;
case
(
int
)
EquationTypeEnum
.
InBetween
:
if
(
model
.
StartType
==
1
)
{
description
+=
model
.
StartValue
+
"<"
+
dayOrHours
;
}
else
{
description
+=
model
.
StartValue
+
"≤"
+
dayOrHours
;
}
if
(
model
.
EndType
==
1
)
{
description
+=
"<"
+
model
.
EndValue
;
}
else
{
description
+=
"≤"
+
model
.
EndValue
;
}
break
;
}
model
.
Description
=
description
;
model
.
AuditList
=
alist
.
Where
(
x
=>
x
.
ConditionId
==
model
.
Id
).
ToList
();
model
.
AuditUserList
=
ulist
.
Where
(
x
=>
x
.
AuditId
==
model
.
Id
).
ToList
();
}
return
list
;
}
/// <summary>
/// 获取条件详情
/// </summary>
/// <param name="ConditionId"></param>
/// <returns></returns>
public
Rb_Workflow_Condition_Extend
GetConditionAndAuditUser
(
int
ConditionId
)
{
var
model
=
respositoryCondition
.
GetEntity
(
ConditionId
).
RefMapperTo
<
Rb_Workflow_Condition_Extend
>();
List
<
Rb_Workflow_Audit_Extend
>
alist
=
respositoryAudit
.
GetDefaultAudit
(
model
.
Id
);
foreach
(
var
item
in
alist
)
{
if
(
item
.
AuditType
==
2
)
item
.
AuditUserList
=
respositoryUser
.
GetConditionAuditUser
(
item
.
Id
);
}
model
.
AuditList
=
alist
;
var
tmodel
=
respository
.
GetEntity
(
model
.
TemplateId
);
if
(
tmodel
!=
null
)
{
model
.
TemplateTypeName
=
tmodel
.
Name
;
model
.
TemplateType
=
(
int
)
tmodel
.
TemplateType
;
}
if
(
tmodel
!=
null
&&
tmodel
.
TemplateType
==
WFTTemplateTypeEnum
.
AskForLeave
)
{
var
AuditType
=
EnumHelper
.
EnumToList
(
typeof
(
AskforleaveTypeEnum
));
List
<
AskforleaveTypeList
>
asklist
=
new
List
<
AskforleaveTypeList
>();
List
<
int
>
askStr
=
JsonConvert
.
DeserializeObject
<
List
<
int
>>(
model
.
AskforleaveType
);
foreach
(
var
item
in
AuditType
)
{
AskforleaveTypeList
askmodel
=
new
AskforleaveTypeList
{
Id
=
item
.
Id
,
Name
=
item
.
Name
};
if
(
askStr
.
Contains
(
askmodel
.
Id
))
{
askmodel
.
Is_show
=
1
;
}
else
{
askmodel
.
Is_show
=
0
;
}
asklist
.
Add
(
askmodel
);
}
model
.
aftList
=
asklist
.
OrderBy
(
x
=>
x
.
Id
).
ToList
();
}
List
<
Rb_Workflow_Audituser_Extend
>
ulist
=
respositoryUser
.
GetDefaultAuditUser
(
model
.
Id
);
model
.
AuditUserList
=
ulist
;
return
model
;
}
/// <summary>
/// 保存分条件
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
bool
SetOtherCondition
(
Rb_Workflow_Condition_Extend
dmodel
)
{
var
trans
=
respository
.
DbTransaction
;
try
{
if
(
dmodel
.
Id
>
0
)
{
Rb_Workflow_Condition
cmodel
=
respositoryCondition
.
GetEntity
(
dmodel
.
Id
);
cmodel
.
AskforleaveType
=
dmodel
.
AskforleaveType
;
cmodel
.
ConditionType
=
dmodel
.
ConditionType
;
cmodel
.
DayHour
=
dmodel
.
DayHour
;
cmodel
.
EndType
=
dmodel
.
EndType
;
cmodel
.
EndValue
=
dmodel
.
EndValue
;
cmodel
.
Sort
=
dmodel
.
Sort
;
cmodel
.
StartType
=
dmodel
.
StartType
;
cmodel
.
StartValue
=
dmodel
.
StartValue
;
bool
Isok
=
respositoryCondition
.
Update
(
cmodel
,
trans
);
if
(
Isok
)
{
//删除所有的审核人 指定成员 抄送人 再重新添加
respositoryCondition
.
DelConditionAuditAndUser
(
dmodel
.
Id
,
trans
);
//新增审核人 和 指定成员
int
Num
=
0
;
if
(
dmodel
.
AuditList
!=
null
)
{
foreach
(
var
item
in
dmodel
.
AuditList
)
{
Num
++;
Rb_Workflow_Audit
auditmodel
=
new
Rb_Workflow_Audit
{
AuditDescription
=
item
.
AuditDescription
,
AuditType
=
item
.
AuditType
,
AuditWay
=
item
.
AuditWay
,
RoleOrInitiator
=
item
.
RoleOrInitiator
,
Sort
=
Num
,
ConditionId
=
dmodel
.
Id
};
int
auditId
=
respositoryAudit
.
Insert
(
auditmodel
,
trans
);
if
(
item
.
AuditType
==
2
)
{
foreach
(
var
d
in
item
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
auditId
,
EmployeeId
=
d
.
EmployeeId
,
EmType
=
1
,
Sort
=
d
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
}
if
(
dmodel
.
AuditUserList
!=
null
)
{
foreach
(
var
item
in
dmodel
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
dmodel
.
Id
,
EmployeeId
=
item
.
EmployeeId
,
EmType
=
2
,
Sort
=
item
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
}
else
{
Rb_Workflow_Condition
cmodel
=
new
Rb_Workflow_Condition
{
AskforleaveType
=
dmodel
.
AskforleaveType
,
ConditionType
=
dmodel
.
ConditionType
,
DayHour
=
dmodel
.
DayHour
,
EndType
=
dmodel
.
EndType
,
EndValue
=
dmodel
.
EndValue
};
int
sort
=
respositoryCondition
.
GetConditionSortMax
(
dmodel
.
TemplateId
.
Value
);
cmodel
.
Sort
=
sort
+
1
;
cmodel
.
StartType
=
dmodel
.
StartType
;
cmodel
.
StartValue
=
dmodel
.
StartValue
;
cmodel
.
TemplateId
=
dmodel
.
TemplateId
;
int
cid
=
respositoryCondition
.
Insert
(
cmodel
,
trans
);
if
(
cid
>
0
)
{
//新增审核人 和 指定成员
int
Num
=
0
;
if
(
dmodel
.
AuditList
!=
null
)
{
foreach
(
var
item
in
dmodel
.
AuditList
)
{
Num
++;
Rb_Workflow_Audit
auditmodel
=
new
Rb_Workflow_Audit
{
AuditDescription
=
item
.
AuditDescription
,
AuditType
=
item
.
AuditType
,
AuditWay
=
item
.
AuditWay
,
RoleOrInitiator
=
item
.
RoleOrInitiator
,
Sort
=
Num
,
ConditionId
=
cid
};
int
auditId
=
respositoryAudit
.
Insert
(
auditmodel
,
trans
);
if
(
item
.
AuditType
==
2
)
{
foreach
(
var
d
in
item
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
auditId
,
EmployeeId
=
d
.
EmployeeId
,
EmType
=
1
,
Sort
=
d
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
}
if
(
dmodel
.
AuditUserList
!=
null
)
{
foreach
(
var
item
in
dmodel
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
cid
,
EmployeeId
=
item
.
EmployeeId
,
EmType
=
2
,
Sort
=
item
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
}
respository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetOtherCondition"
);
respository
.
DBSession
.
Rollback
(
"SetOtherCondition"
);
return
false
;
}
return
true
;
}
/// <summary>
/// 删除分条件
/// </summary>
/// <param name="ConditionId"></param>
/// <returns></returns>
public
bool
DelOtherCondition
(
int
ConditionId
)
{
return
respositoryCondition
.
DelOtherCondition
(
ConditionId
)
>
0
;
}
/// <summary>
/// 保存默认条件
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public
bool
SetDefaultCondition
(
Rb_Workflow_Condition_Extend
dmodel
)
{
var
trans
=
respository
.
DbTransaction
;
try
{
if
(
dmodel
.
Id
>
0
)
{
Rb_Workflow_Condition
cmodel
=
respositoryCondition
.
GetEntity
(
dmodel
.
Id
);
//删除所有的审核人 指定成员 抄送人 再重新添加
respositoryCondition
.
DelConditionAuditAndUser
(
dmodel
.
Id
,
trans
);
//新增审核人 和 指定成员
int
Num
=
0
;
if
(
dmodel
.
AuditList
!=
null
)
foreach
(
var
item
in
dmodel
.
AuditList
)
{
Num
++;
Rb_Workflow_Audit
auditmodel
=
new
Rb_Workflow_Audit
{
AuditDescription
=
item
.
AuditDescription
,
AuditType
=
item
.
AuditType
,
AuditWay
=
item
.
AuditWay
,
RoleOrInitiator
=
item
.
RoleOrInitiator
,
Sort
=
Num
,
ConditionId
=
dmodel
.
Id
};
int
auditId
=
respositoryAudit
.
Insert
(
auditmodel
,
trans
);
if
(
item
.
AuditType
==
2
)
{
foreach
(
var
d
in
item
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
auditId
,
EmployeeId
=
d
.
EmployeeId
,
EmType
=
1
,
Sort
=
d
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
if
(
dmodel
.
AuditUserList
!=
null
)
foreach
(
var
item
in
dmodel
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
dmodel
.
Id
,
EmployeeId
=
item
.
EmployeeId
,
EmType
=
2
,
Sort
=
item
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
//同时修改分条件排序
if
(
dmodel
.
ConditionSortList
!=
null
)
foreach
(
var
item
in
dmodel
.
ConditionSortList
)
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>
{
{
nameof
(
Rb_Workflow_Condition
.
Sort
),
item
.
Sort
},
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>
{
new
WhereHelper
()
{
FiledName
=
nameof
(
Rb_Workflow_Condition
.
Id
),
FiledValue
=
item
.
ConditionId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
respositoryCondition
.
Update
(
fileds
,
whereHelpers
,
trans
);
}
}
else
{
Rb_Workflow_Condition
cmodel
=
new
Rb_Workflow_Condition
{
Sort
=
0
,
TemplateId
=
dmodel
.
TemplateId
};
int
cid
=
respositoryCondition
.
Insert
(
cmodel
,
trans
);
if
(
cid
>
0
)
{
//新增审核人 和 指定成员
int
Num
=
0
;
if
(
dmodel
.
AuditList
!=
null
)
foreach
(
var
item
in
dmodel
.
AuditList
)
{
Num
++;
Rb_Workflow_Audit
auditmodel
=
new
Rb_Workflow_Audit
{
AuditDescription
=
item
.
AuditDescription
,
AuditType
=
item
.
AuditType
,
AuditWay
=
item
.
AuditWay
,
RoleOrInitiator
=
item
.
RoleOrInitiator
,
Sort
=
Num
,
ConditionId
=
cid
};
int
auditId
=
respositoryAudit
.
Insert
(
auditmodel
,
trans
);
if
(
item
.
AuditType
==
2
)
{
foreach
(
var
d
in
item
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
auditId
,
EmployeeId
=
d
.
EmployeeId
,
EmType
=
1
,
Sort
=
d
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
}
}
if
(
dmodel
.
AuditUserList
!=
null
)
foreach
(
var
item
in
dmodel
.
AuditUserList
)
{
Rb_Workflow_Audituser
aumodel
=
new
Rb_Workflow_Audituser
{
AuditId
=
cid
,
EmployeeId
=
item
.
EmployeeId
,
EmType
=
2
,
Sort
=
item
.
Sort
};
respositoryUser
.
Insert
(
aumodel
,
trans
);
}
//同时修改分条件排序
if
(
dmodel
.
ConditionSortList
!=
null
)
foreach
(
var
item
in
dmodel
.
ConditionSortList
)
{
IDictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>
{
{
nameof
(
Rb_Workflow_Condition
.
Sort
),
item
.
Sort
},
};
IList
<
WhereHelper
>
whereHelpers
=
new
List
<
WhereHelper
>
{
new
WhereHelper
()
{
FiledName
=
nameof
(
Rb_Workflow_Condition
.
Id
),
FiledValue
=
item
.
ConditionId
,
OperatorEnum
=
OperatorEnum
.
Equal
}
};
respositoryCondition
.
Update
(
fileds
,
whereHelpers
,
trans
);
}
}
}
respository
.
DBSession
.
Commit
();
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"SetDefaultCondition"
);
respository
.
DBSession
.
Rollback
(
"SetDefaultCondition"
);
return
false
;
}
return
true
;
}
/// <summary>
/// 判断默认条件重复
/// </summary>
/// <param name="TemplateId"></param>
/// <param name="ConditionId"></param>
/// <returns></returns>
public
int
GetDefaultConditionDistinct
(
int
TemplateId
,
int
ConditionId
)
{
return
respositoryCondition
.
GetDefaultConditionDistinct
(
TemplateId
,
ConditionId
);
}
/// <summary>
/// 获取请假分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Askforleave_Extend
>
GetAskforleavePageList
(
int
pageIndex
,
int
pageSize
,
Rb_Workflow_Askforleave_Extend
dmodel
,
out
long
count
)
{
List
<
Rb_Workflow_Askforleave_Extend
>
pageList
=
respositoryAskforleave
.
GetAskforleavePageList
(
pageIndex
,
pageSize
,
dmodel
,
out
count
);
return
pageList
;
}
/// <summary>
/// 获取出差分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Evection_Extend
>
GetEvectionPageList
(
int
pageIndex
,
int
pageSize
,
Rb_Workflow_Evection_Extend
dmodel
,
out
long
count
)
{
List
<
Rb_Workflow_Evection_Extend
>
pageList
=
respositoryEvection
.
GetEvectionPageList
(
pageIndex
,
pageSize
,
dmodel
,
out
count
);
return
pageList
;
}
/// <summary>
/// 获取外出分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_GoOut_Extend
>
GetGoOutPageList
(
int
pageIndex
,
int
pageSize
,
Rb_Workflow_GoOut_Extend
dmodel
,
out
long
count
)
{
List
<
Rb_Workflow_GoOut_Extend
>
pageList
=
respositoryGoout
.
GetGoOutPageList
(
pageIndex
,
pageSize
,
dmodel
,
out
count
);
return
pageList
;
}
/// <summary>
/// 获取补卡分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Reissuecard_Extend
>
GetReissuecardPageList
(
int
pageIndex
,
int
pageSize
,
Rb_Workflow_Reissuecard_Extend
dmodel
,
out
long
count
)
{
List
<
Rb_Workflow_Reissuecard_Extend
>
pageList
=
respositoryReissuecar
.
GetReissuecardPageList
(
pageIndex
,
pageSize
,
dmodel
,
out
count
);
return
pageList
;
}
/// <summary>
/// 获取OA考勤分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="dmodel"></param>
/// <param name="count"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Askforleave_Extend
>
GetOAPageList
(
int
pageIndex
,
int
pageSize
,
Rb_Workflow_Askforleave_Extend
dmodel
,
out
long
count
)
{
List
<
Rb_Workflow_Askforleave_Extend
>
pageList
=
respositoryAskforleave
.
GetOAPageList
(
pageIndex
,
pageSize
,
dmodel
,
out
count
);
return
pageList
;
}
/// <summary>
/// 设置审核可见范围
/// </summary>
/// <param name="tid"></param>
/// <param name="List"></param>
/// <returns></returns>
public
bool
AddTempleteEmployee
(
int
tid
,
List
<
Rb_Workflow_Visualrange
>
List
)
{
//删除原有
var
trans
=
respository
.
DbTransaction
;
try
{
visualrangeRepository
.
DeleteVisualrange
(
tid
,
trans
);
foreach
(
var
item
in
List
)
{
item
.
TemplateId
=
tid
;
}
visualrangeRepository
.
InsertBatch
(
List
,
trans
);
respository
.
DBSession
.
Commit
();
return
true
;
}
catch
(
Exception
ex
)
{
LogHelper
.
Write
(
ex
,
"AddTempleteEmployee"
);
respository
.
DBSession
.
Rollback
(
"AddTempleteEmployee"
);
return
false
;
}
}
/// <summary>
/// 根据模版id 获取可见范围的人
/// </summary>
/// <param name="tid"></param>
/// <returns></returns>
public
List
<
Rb_Workflow_Visualrange_Extend
>
GetTempleteEmployee
(
int
tid
)
{
return
visualrangeRepository
.
GetList
(
tid
);
}
/// <summary>
/// 获取员工列表
/// </summary>
/// <param name="empIds"></param>
/// <returns></returns>
public
List
<
Employee_ViewModel
>
GetEmpList
(
string
empIds
)
{
return
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
empIds
});
}
}
}
Edu.Module.User/WorkFlowModule.cs
0 → 100644
View file @
0269469c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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