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
ebb3abc8
Commit
ebb3abc8
authored
3 years ago
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
aca713f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
DutyPlanModule.cs
Edu.Module.Duty/DutyPlanModule.cs
+20
-0
RB_Duty_PlanRepository.cs
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
+1
-0
TimerJobj.cs
Edu.WebApi/Timers/TimerJobj.cs
+47
-2
No files found.
Edu.Module.Duty/DutyPlanModule.cs
View file @
ebb3abc8
...
@@ -894,6 +894,26 @@ namespace Edu.Module.Duty
...
@@ -894,6 +894,26 @@ namespace Edu.Module.Duty
return
flag
;
return
flag
;
}
}
/// <summary>
/// 更新用户【未值班】状态
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public
bool
UpdateNoDutyModule
(
int
Id
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Duty_PlanDetails_ViewModel
.
Status
),
(
int
)
DutyStatusEnum
.
NoDuty
},
};
List
<
WhereHelper
>
list
=
new
List
<
WhereHelper
>()
{
new
WhereHelper
(
nameof
(
RB_Duty_PlanDetails_ViewModel
.
Id
),
Id
),
};
var
flag
=
duty_PlanDetailsRepository
.
Update
(
fileds
,
list
);
return
flag
;
}
/// <summary>
/// <summary>
/// 新增修改值班事项
/// 新增修改值班事项
/// </summary>
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Edu.Repository/Duty/RB_Duty_PlanRepository.cs
View file @
ebb3abc8
...
@@ -36,6 +36,7 @@ namespace Edu.Repository.Duty
...
@@ -36,6 +36,7 @@ namespace Edu.Repository.Duty
{
{
joinWhere
+=
string
.
Format
(
" AND Status={0} "
,
query
.
QDutyStatus
);
joinWhere
+=
string
.
Format
(
" AND Status={0} "
,
query
.
QDutyStatus
);
}
}
//迟到
//迟到
if
(
query
.
QAttendanceStatus
==
1
)
if
(
query
.
QAttendanceStatus
==
1
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Edu.WebApi/Timers/TimerJobj.cs
View file @
ebb3abc8
using
Edu.Common.Plugin
;
using
Edu.Common.Plugin
;
using
Edu.Module.Duty
;
using
System
;
using
System
;
using
System.IO
;
using
System.IO
;
using
System.Threading
;
using
System.Threading
;
...
@@ -7,33 +8,44 @@ namespace Edu.WebApi.Timers
...
@@ -7,33 +8,44 @@ namespace Edu.WebApi.Timers
{
{
public
class
TimerJobj
public
class
TimerJobj
{
{
private
static
DutyPlanModule
dutyPlanModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
DutyPlanModule
>();
static
System
.
Timers
.
Timer
timer1
;
//计时器
static
System
.
Timers
.
Timer
timer1
;
//计时器
static
System
.
Timers
.
Timer
timer2
;
//定期处理未值班数据
public
static
void
RunTimer
()
public
static
void
RunTimer
()
{
{
timer1
=
new
System
.
Timers
.
Timer
();
timer1
=
new
System
.
Timers
.
Timer
();
timer1
.
Interval
=
1000
*
(
60
*
60
)
*
3
;
//60分钟
timer1
.
Interval
=
1000
*
(
60
*
60
)
*
3
;
//60分钟
timer1
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
ClearFile
);
timer1
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
ClearFile
);
timer1
.
Enabled
=
true
;
timer1
.
Enabled
=
true
;
timer2
=
new
System
.
Timers
.
Timer
();
timer2
.
Interval
=
(
1000
*
60
)
*
(
60
*
2
);
//2小时执行一次
timer2
.
Elapsed
+=
new
System
.
Timers
.
ElapsedEventHandler
(
DealDuty
);
timer2
.
Enabled
=
true
;
}
}
public
static
void
RunStop
()
public
static
void
RunStop
()
{
{
timer1
.
Enabled
=
false
;
timer1
.
Enabled
=
false
;
timer2
.
Enabled
=
false
;
}
}
/// <summary>
/// <summary>
/// 防止重置
/// 防止重置
/// </summary>
/// </summary>
private
static
int
inTimer
=
0
;
private
static
int
inTimer
=
0
;
private
static
int
inTimer2
=
0
;
/// <summary>
/// <summary>
/// 清理文件
/// 清理文件
/// </summary>
/// </summary>
/// <param name="sender"></param>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <param name="e"></param>
public
static
void
ClearFile
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
public
static
void
ClearFile
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
Interlocked
.
Exchange
(
ref
inTimer
,
1
)
==
0
)
if
(
Interlocked
.
Exchange
(
ref
inTimer
,
1
)
==
0
)
{
{
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
rootBook
=
AppDomain
.
CurrentDomain
.
BaseDirectory
;
...
@@ -71,5 +83,38 @@ namespace Edu.WebApi.Timers
...
@@ -71,5 +83,38 @@ namespace Edu.WebApi.Timers
Interlocked
.
Exchange
(
ref
inTimer
,
0
);
Interlocked
.
Exchange
(
ref
inTimer
,
0
);
}
}
}
}
/// <summary>
/// 处理值班数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public
static
void
DealDuty
(
object
sender
,
System
.
Timers
.
ElapsedEventArgs
e
)
{
if
(
Interlocked
.
Exchange
(
ref
inTimer2
,
1
)
==
0
)
{
var
list
=
dutyPlanModule
.
GetDutyPlanPageModule
(
1
,
20
,
out
_
,
new
Model
.
ViewModel
.
Duty
.
RB_Duty_Plan_ViewModel
()
{
QDutyStatus
=
0
,
QEndDate
=
Common
.
ConvertHelper
.
FormatDate
(
DateTime
.
Now
.
AddDays
(
1
))
});
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
foreach
(
var
subItem
in
item
.
PlanDetails
)
{
var
endTime
=
Convert
.
ToDateTime
((
Common
.
ConvertHelper
.
FormatDate
(
item
.
Date
)
+
" "
+
subItem
.
EndTime
)).
AddHours
(
2
);
if
(
subItem
.
Status
==
Common
.
Enum
.
Duty
.
DutyStatusEnum
.
NoStart
&&
endTime
<
DateTime
.
Now
)
{
dutyPlanModule
.
UpdateNoDutyModule
(
subItem
.
Id
);
}
}
}
}
Interlocked
.
Exchange
(
ref
inTimer2
,
0
);
}
}
}
}
}
}
This diff is collapsed.
Click to expand it.
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