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
5df0b5a5
Commit
5df0b5a5
authored
Feb 27, 2023
by
ryun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into release/v23.2.19高县版
parents
36c8aed5
179d5292
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
57 deletions
+25
-57
performance/Performance.Api/Job/AutoSyncConfigJob.cs
+25
-45
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+0
-10
performance/Performance.Services/EmployeeService.cs
+0
-2
No files found.
performance/Performance.Api/Job/AutoSyncConfigJob.cs
View file @
5df0b5a5
using
FluentScheduler
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
using
Performance.Infrastructure
;
...
...
@@ -12,16 +13,18 @@ namespace Performance.Api
public
class
AutoSyncConfigJob
:
IJob
{
private
readonly
ILogger
logger
;
private
readonly
IConfiguration
_configuration
;
private
readonly
PerforPerallotRepository
perallotRepository
;
private
readonly
ConfigService
configService
;
public
AutoSyncConfigJob
(
ILogger
<
AutoSyncConfigJob
>
logger
,
IConfiguration
configuration
,
PerforPerallotRepository
perallotRepository
,
ConfigService
configService
)
ConfigService
configService
)
{
this
.
logger
=
logger
;
_configuration
=
configuration
;
this
.
perallotRepository
=
perallotRepository
;
this
.
configService
=
configService
;
}
...
...
@@ -30,54 +33,31 @@ public void Execute()
{
try
{
logger
.
LogInformation
(
"开始同步配置"
);
//先查询perallot所有数据
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
@switch
=
_configuration
.
GetValue
(
"Application:OpenAutoSyncConfig"
,
false
);
logger
.
LogInformation
(
$"同步配置开关:
{
@switch
}
"
);
if
(
@switch
)
{
//按年月进行倒序查询allots
var
allots
=
list
.
Where
(
w
=>
w
.
HospitalId
==
hospitalId
&&
string
.
IsNullOrEmpty
(
w
.
Path
)
&&
w
.
IsModifyConfig
!=
1
)?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
if
(
allots
==
null
||
!
allots
.
Any
())
continue
;
foreach
(
var
item
in
allots
)
{
configService
.
NewCopy
(
new
CopyRequest
()
{
AllotId
=
item
.
ID
,
Type
=
new
[]
{
"personnels"
,
"workItems"
,
"drugTypeDisburses"
,
"drugTypeFactors"
,
"deptTypes"
,
"agains"
,
"accountings"
,
"department"
}
});
}
#
region
旧代码
logger
.
LogInformation
(
"开始同步配置"
);
////如果allots不为null 并且 数据存在没修改过的,进行循环
//while (allots != null && allots.Any(w => w.IsModifyConfig == 0) && allots.Any(w => w.IsModifyConfig == 1))
//{
// //查询最近一次修改过的allot
// var prevAllot = allots.FirstOrDefault(t => t.IsModifyConfig == 1);
// //if (prevAllot == null) continue;
//先查询perallot所有数据
var
list
=
perallotRepository
.
GetEntities
();
if
(
list
==
null
||
!
list
.
Any
())
return
;
// //获取最近一次修改过的月份
// var date = ConvertHelper.To<DateTime>($"{prevAllot.Year}-{prevAllot.Month}");
// //查找需要同步的allot(条件为 最近一次修改过的月份之后的所有allot)
// var needSyncData = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") > date);
// if (needSyncData != null && needSyncData.Any())
// {
// //开始同步查询到的allot
// foreach (var item in needSyncData)
// configService.NewCopy(new CopyRequest() { AllotId = item.ID, Type = new[] { "personnels", "workItems", "drugTypeDisburses", "drugTypeFactors", "deptTypes", "agains", "accountings", "department" } });
// }
// //同步完之后查询 最近一次修改过的allot 之前的第一条未修改的allot
// 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}");
var
hospitalIds
=
list
.
Select
(
t
=>
t
.
HospitalId
).
Distinct
().
OrderBy
(
t
=>
t
);
//按照医院循环
foreach
(
var
hospitalId
in
hospitalIds
)
{
//按年月进行倒序查询allots
var
allots
=
list
.
Where
(
w
=>
w
.
HospitalId
==
hospitalId
&&
string
.
IsNullOrEmpty
(
w
.
Path
)
&&
w
.
IsModifyConfig
!=
1
)?.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
if
(
allots
==
null
||
!
allots
.
Any
())
continue
;
// //当次循环allots只保留 小于 最近一次修改过的月份
// allots = allots.Where(w => ConvertHelper.To<DateTime>($"{w.Year}-{w.Month}") <= date)?.ToList();
//}
#
endregion
foreach
(
var
item
in
allots
)
{
configService
.
NewCopy
(
new
CopyRequest
()
{
AllotId
=
item
.
ID
,
Type
=
new
[]
{
"personnels"
,
"workItems"
,
"drugTypeDisburses"
,
"drugTypeFactors"
,
"deptTypes"
,
"agains"
,
"accountings"
,
"department"
}
});
}
}
logger
.
LogInformation
(
"同步配置结束"
);
}
logger
.
LogInformation
(
"同步配置结束"
);
}
catch
(
Exception
ex
)
{
...
...
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
5df0b5a5
...
...
@@ -64,16 +64,6 @@
开启反SQL注入白名单地址
</summary>
</member>
<member
name=
"T:Performance.DtoModels.AppSettings.AppSQLEncrypt"
>
<summary>
数据库密码加密
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.AppSQLEncrypt.IsEncryption"
>
<summary>
是否加密 true 加密 false 明文
</summary>
</member>
<member
name=
"P:Performance.DtoModels.AppSettings.RateLimitingConfig.Endpoints"
>
<summary>
路径
...
...
performance/Performance.Services/EmployeeService.cs
View file @
5df0b5a5
...
...
@@ -504,7 +504,6 @@ public bool SubmitDeptList(SubmitAmountRequest request)
result
.
ForEach
(
w
=>
{
w
.
Status
=
2
;
w
.
Remark
=
request
.
Remark
;
});
return
perapramountRepository
.
UpdateRange
(
result
.
ToArray
());
...
...
@@ -1164,7 +1163,6 @@ public bool SubmitHideDeptList(SubmitAmountRequest request)
result
.
ForEach
(
w
=>
{
w
.
Status
=
2
;
w
.
Remark
=
request
.
Remark
;
});
return
_hideRepository
.
UpdateRange
(
result
.
ToArray
());
...
...
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