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
8c6a7a03
Commit
8c6a7a03
authored
Jan 18, 2022
by
lcx
Committed by
纪旭 韦
Jan 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定时加载上月绩效
parent
d46d4293
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
122 additions
and
24 deletions
+122
-24
performance/Performance.Api/Controllers/AllotController.cs
+1
-0
performance/Performance.Api/Job/AutoSyncConfigJob.cs
+72
-0
performance/Performance.Api/Job/JobRegistry.cs
+2
-9
performance/Performance.Api/Startup.cs
+1
-0
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
+5
-0
performance/Performance.EntityModels/Entity/per_allot.cs
+5
-0
performance/Performance.Services/ConfigService.cs
+36
-15
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
8c6a7a03
...
...
@@ -231,6 +231,7 @@ public ApiResponse ImportExtraction(int allotId)
allot
.
Remark
=
EnumHelper
.
GetDescription
(
AllotStates
.
FileUploaded
);
allot
.
UploadDate
=
DateTime
.
Now
;
allot
.
Generate
=
(
int
)
AllotGenerate
.
Init
;
allot
.
IsModifyConfig
=
1
;
if
(!
_allotService
.
Update
(
allot
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"上传成功,修改状态失败"
);
_configService
.
Clear
(
allot
.
ID
);
...
...
performance/Performance.Api/Job/AutoSyncConfigJob.cs
0 → 100644
View file @
8c6a7a03
using
FluentScheduler
;
using
Microsoft.Extensions.Logging
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
Performance.Services
;
using
System
;
using
System.Linq
;
namespace
Performance.Api
{
public
class
AutoSyncConfigJob
:
IJob
{
private
readonly
ILogger
logger
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
ConfigService
configService
;
public
AutoSyncConfigJob
(
ILogger
<
AutoSyncConfigJob
>
logger
,
PerforPerallotRepository
perallotRepository
,
ConfigService
configService
)
{
this
.
logger
=
logger
;
this
.
perallotRepository
=
perallotRepository
;
this
.
configService
=
configService
;
}
public
void
Execute
()
{
try
{
logger
.
LogInformation
(
"开始同步配置"
);
var
list
=
perallotRepository
.
GetEntities
();
if
(
list
==
null
||
!
list
.
Any
())
return
;
var
hospitalIds
=
list
.
Select
(
t
=>
t
.
HospitalId
).
Distinct
().
OrderBy
(
t
=>
t
);
foreach
(
var
hospitalId
in
hospitalIds
)
{
var
allots
=
list
.
Where
(
w
=>
w
.
HospitalId
==
hospitalId
)?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
if
(
allots
==
null
||
!
allots
.
Any
())
continue
;
while
(
allots
!=
null
&&
allots
.
Any
(
w
=>
w
.
IsModifyConfig
==
0
))
{
var
prevAllot
=
allots
.
FirstOrDefault
(
t
=>
t
.
IsModifyConfig
==
1
);
if
(
prevAllot
==
null
)
continue
;
var
date
=
ConvertHelper
.
To
<
DateTime
>(
$"
{
prevAllot
.
Year
}
-
{
prevAllot
.
Month
}
"
);
var
needSyncData
=
allots
.
Where
(
w
=>
ConvertHelper
.
To
<
DateTime
>(
$"
{
w
.
Year
}
-
{
w
.
Month
}
"
)
>
date
);
if
(
needSyncData
!=
null
&&
needSyncData
.
Any
())
{
foreach
(
var
item
in
needSyncData
)
configService
.
CopyCommand
(
item
,
prevAllot
.
ID
,
true
);
}
var
noModify
=
allots
.
FirstOrDefault
(
w
=>
ConvertHelper
.
To
<
DateTime
>(
$"
{
w
.
Year
}
-
{
w
.
Month
}
"
)
<
date
&&
w
.
IsModifyConfig
==
0
);
if
(
noModify
!=
null
)
date
=
ConvertHelper
.
To
<
DateTime
>(
$"
{
noModify
.
Year
}
-
{
noModify
.
Month
}
"
);
allots
=
allots
.
Where
(
w
=>
ConvertHelper
.
To
<
DateTime
>(
$"
{
w
.
Year
}
-
{
w
.
Month
}
"
)
<=
date
)?.
ToList
();
}
}
logger
.
LogInformation
(
"同步配置结束"
);
}
catch
(
Exception
ex
)
{
logger
.
LogError
(
$"同步配置发生异常:"
+
ex
);
}
}
}
}
performance/Performance.Api/Job/JobRegistry.cs
View file @
8c6a7a03
using
FluentScheduler
;
using
System
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Caching.Memory
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Performance.Repository
;
using
Performance.DtoModels
;
using
Performance.Services
;
using
System
;
namespace
Performance.Api
{
...
...
@@ -21,6 +13,7 @@ public JobRegistry(IServiceProvider provider)
Schedule
(()
=>
provider
.
GetService
<
ExtractGenerateJob
>()).
ToRunEvery
(
1
).
Days
().
At
(
23
,
00
);
//Schedule(() => provider.GetService<ClearLoggerJob>()).ToRunNow().AndEvery(60).Seconds();
Schedule
(()
=>
provider
.
GetService
<
ClearLoggerJob
>()).
ToRunNow
().
AndEvery
(
1
).
Days
().
At
(
3
,
00
);
Schedule
(()
=>
provider
.
GetService
<
AutoSyncConfigJob
>()).
ToRunNow
().
AndEvery
(
1
).
Days
().
At
(
0
,
00
);
}
}
}
performance/Performance.Api/Startup.cs
View file @
8c6a7a03
...
...
@@ -102,6 +102,7 @@ public void ConfigureServices(IServiceCollection services)
services
.
AddTransient
<
ExtractGenerateJob
>();
services
.
AddTransient
<
ExtractDataJob
>();
services
.
AddTransient
<
ClearLoggerJob
>();
services
.
AddTransient
<
AutoSyncConfigJob
>();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
...
performance/Performance.Api/wwwroot/Performance.EntityModels.xml
View file @
8c6a7a03
...
...
@@ -5905,6 +5905,11 @@
自定义提取绩效数据文件生成路径
</summary>
</member>
<member
name=
"P:Performance.EntityModels.per_allot.IsModifyConfig"
>
<summary>
是否修改过配置 1修改过 0未修改
</summary>
</member>
<member
name=
"T:Performance.EntityModels.per_apr_amount"
>
<summary>
...
...
performance/Performance.EntityModels/Entity/per_allot.cs
View file @
8c6a7a03
...
...
@@ -100,5 +100,10 @@ public class per_allot
/// 自定义提取绩效数据文件生成路径
/// </summary>
public
string
CustomExtractPath
{
get
;
set
;
}
/// <summary>
/// 是否修改过配置 1修改过 0未修改
/// </summary>
public
int
IsModifyConfig
{
get
;
set
;
}
}
}
performance/Performance.Services/ConfigService.cs
View file @
8c6a7a03
...
...
@@ -913,6 +913,11 @@ public void Copy(per_allot allot)
int
allotId
=
index
+
1
<
list
.
Count
?
list
[
index
+
1
].
ID
:
list
.
First
().
ID
;
if
(
allotId
==
allot
.
ID
)
allotId
=
-
1
;
CopyCommand
(
allot
,
allotId
);
}
public
void
CopyCommand
(
per_allot
allot
,
int
prevAllotId
,
bool
delHistotyData
=
false
)
{
#
region
弃用
//var hospital = perforHospitalRepository.GetEntity(t => t.ID == allot.HospitalId);
...
...
@@ -965,13 +970,17 @@ public void Copy(per_allot allot)
#
endregion
personService
.
CreateAllotPersons
(
allot
.
HospitalId
,
allot
.
ID
,
allotId
);
var
flag
=
delHistotyData
;
personService
.
CreateAllotPersons
(
allot
.
HospitalId
,
allot
.
ID
,
prevAllotId
);
logger
.
LogInformation
(
$"copy workItems"
);
var
workItems
=
_workitemRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
workItems
==
null
||
!
workItems
.
Any
())
if
(
delHistotyData
&&
workItems
!=
null
&&
workItems
.
Any
())
flag
=
_workitemRepository
.
RemoveRange
(
workItems
.
ToArray
());
if
(
flag
||
workItems
==
null
||
!
workItems
.
Any
())
{
workItems
=
_workitemRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
_workitemRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
workItems
=
_workitemRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
_workitemRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
workItems
!=
null
&&
workItems
.
Any
())
{
var
newWorkItems
=
workItems
.
Select
(
t
=>
new
cof_workitem
{
AllotID
=
allot
.
ID
,
Type
=
t
.
Type
,
Item
=
t
.
Item
});
...
...
@@ -981,9 +990,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy drugTypes"
);
var
drugTypes
=
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
drugTypes
==
null
||
!
drugTypes
.
Any
())
if
(
delHistotyData
&&
drugTypes
!=
null
&&
drugTypes
.
Any
())
flag
=
_drugtypeRepository
.
RemoveRange
(
drugTypes
.
ToArray
());
if
(
flag
||
drugTypes
==
null
||
!
drugTypes
.
Any
())
{
drugTypes
=
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
drugTypes
=
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
_drugtypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
drugTypes
!=
null
&&
drugTypes
.
Any
())
{
var
newDrugTypes
=
drugTypes
.
Select
(
t
=>
new
cof_drugtype
{
HospitalId
=
allot
.
HospitalId
,
AllotID
=
allot
.
ID
,
Charge
=
t
.
Charge
,
ChargeType
=
t
.
ChargeType
});
...
...
@@ -993,9 +1004,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy drugTypeDisburses"
);
var
drugTypeDisburses
=
drugtypeDisburseRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
drugTypeDisburses
==
null
||
!
drugTypeDisburses
.
Any
())
if
(
delHistotyData
&&
drugTypeDisburses
!=
null
&&
drugTypeDisburses
.
Any
())
flag
=
drugtypeDisburseRepository
.
RemoveRange
(
drugTypeDisburses
.
ToArray
());
if
(
flag
||
drugTypeDisburses
==
null
||
!
drugTypeDisburses
.
Any
())
{
drugTypeDisburses
=
drugtypeDisburseRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
drugtypeDisburseRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
drugTypeDisburses
=
drugtypeDisburseRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
drugtypeDisburseRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
drugTypeDisburses
!=
null
&&
drugTypeDisburses
.
Any
())
{
var
newDrugTypeDisburses
=
drugTypeDisburses
.
Select
(
t
=>
new
cof_drugtype_disburse
{
HospitalId
=
allot
.
HospitalId
,
AllotID
=
allot
.
ID
,
Charge
=
t
.
Charge
,
ChargeType
=
t
.
ChargeType
});
...
...
@@ -1005,9 +1018,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy drugTypeFactors"
);
var
drugTypeFactors
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
drugTypeFactors
==
null
||
!
drugTypeFactors
.
Any
())
if
(
delHistotyData
&&
drugTypeFactors
!=
null
&&
drugTypeFactors
.
Any
())
flag
=
cofdrugtypefactorRepository
.
RemoveRange
(
drugTypeFactors
.
ToArray
());
if
(
flag
||
drugTypeFactors
==
null
||
!
drugTypeFactors
.
Any
())
{
drugTypeFactors
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
drugTypeFactors
=
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
cofdrugtypefactorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
drugTypeFactors
!=
null
&&
drugTypeFactors
.
Any
())
{
var
newDrugtypeFactors
=
drugTypeFactors
.
Select
(
t
=>
new
cof_drugtype_factor
...
...
@@ -1026,9 +1041,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy deptTypes"
);
var
deptTypes
=
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
deptTypes
==
null
||
!
deptTypes
.
Any
())
if
(
delHistotyData
&&
deptTypes
!=
null
&&
deptTypes
.
Any
())
flag
=
perforCofdepttypeRepository
.
RemoveRange
(
deptTypes
.
ToArray
());
if
(
flag
||
deptTypes
==
null
||
!
deptTypes
.
Any
())
{
deptTypes
=
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
deptTypes
=
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
perforCofdepttypeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
deptTypes
!=
null
&&
deptTypes
.
Any
())
{
var
newDeptTypes
=
deptTypes
.
Select
(
t
=>
new
cof_depttype
{
AllotID
=
allot
.
ID
,
Charge
=
t
.
Charge
,
ChargeType
=
t
.
ChargeType
});
...
...
@@ -1038,9 +1055,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy agains"
);
var
agains
=
_againRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
if
(
agains
==
null
||
!
agains
.
Any
())
if
(
delHistotyData
&&
agains
!=
null
&&
agains
.
Any
())
flag
=
_againRepository
.
RemoveRange
(
agains
.
ToArray
());
if
(
flag
||
agains
==
null
||
!
agains
.
Any
())
{
agains
=
_againRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
a
llotId
)
??
_againRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
agains
=
_againRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
prevA
llotId
)
??
_againRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
-
1
);
if
(
agains
!=
null
&&
agains
.
Any
())
{
var
days
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
...
...
@@ -1051,9 +1070,11 @@ public void Copy(per_allot allot)
logger
.
LogInformation
(
$"copy accountings"
);
var
accountings
=
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
accountings
==
null
||
!
accountings
.
Any
())
if
(
delHistotyData
&&
accountings
!=
null
&&
accountings
.
Any
())
flag
=
cofaccountingRepository
.
RemoveRange
(
accountings
.
ToArray
());
if
(
flag
||
accountings
==
null
||
!
accountings
.
Any
())
{
accountings
=
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
a
llotId
)
??
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
-
1
);
accountings
=
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
prevA
llotId
)
??
cofaccountingRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
-
1
);
if
(
accountings
!=
null
&&
accountings
.
Any
())
{
var
newAccountings
=
accountings
.
Select
(
t
=>
new
cof_accounting
{
AllotId
=
allot
.
ID
,
UnitType
=
t
.
UnitType
,
AccountingUnit
=
t
.
AccountingUnit
});
...
...
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