Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
Overview
Details
Activity
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
c518440e
Commit
c518440e
authored
Jul 17, 2024
by
wyc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重复任务关闭,科室分组
parent
9021d490
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
11 deletions
+28
-11
performance/Performance.Api/Job/BackgroundJob.cs
+16
-8
performance/Performance.Api/wwwroot/Performance.Api.xml
+1
-1
performance/Performance.Services/ConfigService.cs
+11
-2
No files found.
performance/Performance.Api/Job/BackgroundJob.cs
View file @
c518440e
...
@@ -43,7 +43,7 @@ public void Execute()
...
@@ -43,7 +43,7 @@ public void Execute()
{
{
using
(
var
scope
=
_serviceScopeFactory
.
CreateScope
())
using
(
var
scope
=
_serviceScopeFactory
.
CreateScope
())
{
{
var
service
=
scope
.
ServiceProvider
.
GetService
<
TaskService
>();
var
service
=
scope
.
ServiceProvider
.
GetService
<
TaskService
>();
var
tasks
=
service
.
GetTasks
();
var
tasks
=
service
.
GetTasks
();
if
(
tasks
==
null
||
tasks
.
Count
==
0
)
if
(
tasks
==
null
||
tasks
.
Count
==
0
)
...
@@ -374,26 +374,34 @@ private void Timeout(TaskService service, List<bg_task> tasks)
...
@@ -374,26 +374,34 @@ private void Timeout(TaskService service, List<bg_task> tasks)
}
}
}
}
/// <summary>
/// <summary>
/// 重复任务仅执行最后
异常
/// 重复任务仅执行最后
一次(存在执行只的任务,就将后加的任务停止)
/// </summary>
/// </summary>
/// <param name="service"></param>
/// <param name="service"></param>
/// <param name="tasks"></param>
/// <param name="tasks"></param>
private
void
Repeat
(
TaskService
service
,
List
<
bg_task
>
tasks
)
private
void
Repeat
(
TaskService
service
,
List
<
bg_task
>
tasks
)
{
{
var
gps
=
tasks
var
waitingTasks
=
tasks
.
Where
(
w
=>
w
.
Status
==
(
int
)
Background
.
Status
.
等待
).
ToList
();
.
Where
(
w
=>
w
.
Status
==
(
int
)
Background
.
Status
.
等待
)
.
GroupBy
(
w
=>
new
{
w
.
JobType
,
w
.
Argument
});
foreach
(
var
item
in
gps
)
var
groupedTasks
=
waitingTasks
.
GroupBy
(
w
=>
new
{
w
.
JobType
,
w
.
Argument
})
.
ToList
();
foreach
(
var
group
in
groupedTasks
)
{
{
foreach
(
var
task
in
item
)
var
maxId
=
group
.
Max
(
w
=>
w
.
ID
);
var
isExist
=
tasks
.
Any
(
w
=>
w
.
JobType
==
group
.
Key
.
JobType
&&
w
.
Argument
==
group
.
Key
.
Argument
&&
w
.
Status
==
(
int
)
Background
.
Status
.
执行中
);
foreach
(
var
task
in
group
)
{
{
if
(
task
.
Status
==
(
int
)
Background
.
Status
.
等待
&&
task
.
ID
!=
item
.
Max
(
w
=>
w
.
ID
))
if
((
task
.
Status
==
(
int
)
Background
.
Status
.
等待
&&
task
.
ID
!=
maxId
)
||
isExist
)
{
service
.
Update
(
task
.
ID
,
Background
.
Status
.
无效
,
"任务重复"
);
service
.
Update
(
task
.
ID
,
Background
.
Status
.
无效
,
"任务重复"
);
}
}
}
}
}
}
}
private
class
BackgroundSetting
private
class
BackgroundSetting
{
{
public
Background
.
JobType
JobType
{
get
;
internal
set
;
}
public
Background
.
JobType
JobType
{
get
;
internal
set
;
}
...
...
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
c518440e
...
@@ -3334,7 +3334,7 @@
...
@@ -3334,7 +3334,7 @@
</member>
</member>
<member
name=
"M:Performance.Api.BackgroundJob.Repeat(Performance.Services.TaskService,System.Collections.Generic.List{Performance.EntityModels.bg_task})"
>
<member
name=
"M:Performance.Api.BackgroundJob.Repeat(Performance.Services.TaskService,System.Collections.Generic.List{Performance.EntityModels.bg_task})"
>
<summary>
<summary>
重复任务仅执行最后
异常
重复任务仅执行最后
一次(存在执行只的任务,就将后加的任务停止)
</summary>
</summary>
<param
name=
"service"
></param>
<param
name=
"service"
></param>
<param
name=
"tasks"
></param>
<param
name=
"tasks"
></param>
...
...
performance/Performance.Services/ConfigService.cs
View file @
c518440e
...
@@ -530,8 +530,17 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
...
@@ -530,8 +530,17 @@ public List<cof_accounting> GetAccountingList(AccoungingRequest request)
}
}
if
(
request
.
Type
==
(
int
)
AccountTypeEnum
.
AccountingUnit
&&
!
string
.
IsNullOrEmpty
(
request
.
UnitType
))
if
(
request
.
Type
==
(
int
)
AccountTypeEnum
.
AccountingUnit
&&
!
string
.
IsNullOrEmpty
(
request
.
UnitType
))
exp
=
exp
.
And
(
t
=>
t
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
)
==
request
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
));
{
string
processedRequestUnitType
=
request
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
)
.
Replace
(
"行政中层"
,
"行政工勤"
)
.
Replace
(
"行政高层"
,
"行政工勤"
);
exp
=
exp
.
And
(
t
=>
t
.
UnitType
.
Replace
(
"行政后勤"
,
"行政工勤"
)
.
Replace
(
"行政中层"
,
"行政工勤"
)
.
Replace
(
"行政高层"
,
"行政工勤"
)
==
processedRequestUnitType
);
}
return
_cofaccountingRepository
.
GetEntities
(
exp
)?.
OrderBy
(
t
=>
t
.
IsVerify
).
ThenBy
(
t
=>
ConvertHelper
.
To
<
int
>(
t
.
Code
)).
ToList
()
??
new
List
<
cof_accounting
>();
return
_cofaccountingRepository
.
GetEntities
(
exp
)?.
OrderBy
(
t
=>
t
.
IsVerify
).
ThenBy
(
t
=>
ConvertHelper
.
To
<
int
>(
t
.
Code
)).
ToList
()
??
new
List
<
cof_accounting
>();
}
}
...
...
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