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
e36acb62
Commit
e36acb62
authored
Mar 23, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改返回日志方式
parent
9182833f
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
163 additions
and
114 deletions
+163
-114
performance/Performance.Api/Controllers/AllotController.cs
+8
-7
performance/Performance.Api/Controllers/TemplateController.cs
+5
-13
performance/Performance.DtoModels/Hubs/SingleData.cs
+23
-0
performance/Performance.Services/AllotCompute/ImportDataService.cs
+8
-11
performance/Performance.Services/AllotCompute/ProcessComputService.cs
+4
-4
performance/Performance.Services/AllotService.cs
+21
-38
performance/Performance.Services/ConfigService.cs
+13
-18
performance/Performance.Services/Hubs/AllotLogHub.cs
+6
-19
performance/Performance.Services/Hubs/NotificationsService.cs
+75
-4
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
e36acb62
...
...
@@ -3,6 +3,7 @@
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Caching.Memory
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Performance.DtoModels
;
...
...
@@ -235,13 +236,13 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
if
(
allot
.
States
==
(
int
)
AllotStates
.
Wait
)
return
new
ApiResponse
(
ResponseType
.
OK
,
"当前绩效正在等待生成"
);
int
userId
=
_claim
.
GetUserId
()
;
var
uuid
=
Guid
.
NewGuid
().
ToString
(
"N"
);
_notificationsService
.
SendGenerateMessage
(
userId
,
allot
.
ID
,
$"准备生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效,请稍等!"
);
string
key
=
NotificationsService
.
AllotGenerateKeyPrefix
+
allot
.
ID
;
_notificationsService
.
SetCache
(
key
,
new
SingleData
(
Guid
.
NewGuid
().
ToString
(
"N"
),
_claim
.
GetUserId
())
);
_notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"准备生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效,请稍等!"
);
_allotService
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
Wait
,
EnumHelper
.
GetDescription
(
AllotStates
.
Wait
),
allot
.
Generate
);
if
(
_evn
.
IsEnvironment
(
"Localhost"
))
{
_allotService
.
Generate
(
allot
,
email
,
uuid
,
userId
);
_allotService
.
Generate
(
allot
,
email
);
}
else
{
...
...
@@ -252,13 +253,13 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody] A
using
(
var
scope
=
_serviceScopeFactory
.
CreateScope
())
{
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
AllotService
>();
scopedServices
.
Generate
(
allot
,
email
,
uuid
,
userId
);
scopedServices
.
Generate
(
allot
,
email
);
await
Task
.
Delay
(
TimeSpan
.
FromSeconds
(
5
),
token
);
}
});
}
_notificationsService
.
SendGenerateMessage
(
userId
,
allot
.
ID
,
$"等待绩效生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效,请稍等!"
);
_notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"等待绩效生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效,请稍等!"
);
//_allotService.Generate(allot, email);
////BackgroundJob.Enqueue(() => _allotService.Generate(allot, email));
return
new
ApiResponse
(
ResponseType
.
OK
);
...
...
@@ -273,7 +274,7 @@ public ApiResponse Recalculation([FromBody] RecalculationRequest request)
return new ApiResponse(ResponseType.OK);
}
*/
/// <summary>
/// 重新计算院领导绩效
/// </summary>
...
...
performance/Performance.Api/Controllers/TemplateController.cs
View file @
e36acb62
...
...
@@ -35,7 +35,7 @@ public class TemplateController : Controller
private
readonly
ExConfigService
configService
;
private
readonly
HospitalService
hospitalService
;
private
readonly
AllotService
allotService
;
private
readonly
LogManageService
log
Service
;
private
readonly
NotificationsService
notifications
Service
;
private
readonly
IServiceScopeFactory
serviceScopeFactory
;
public
TemplateController
(
...
...
@@ -49,7 +49,7 @@ public class TemplateController : Controller
ExConfigService
configService
,
HospitalService
hospitalService
,
AllotService
allotService
,
LogManageService
log
Service
,
NotificationsService
notifications
Service
,
IServiceScopeFactory
serviceScopeFactory
)
{
this
.
logger
=
logger
;
...
...
@@ -62,7 +62,7 @@ public class TemplateController : Controller
this
.
configService
=
configService
;
this
.
hospitalService
=
hospitalService
;
this
.
allotService
=
allotService
;
this
.
logService
=
log
Service
;
this
.
notificationsService
=
notifications
Service
;
this
.
serviceScopeFactory
=
serviceScopeFactory
;
}
...
...
@@ -365,18 +365,10 @@ public ApiResponse SaveFile()
/// <param name="request"></param>
[
Route
(
"returnlog"
)]
[
HttpPost
]
[
AllowAnonymous
]
public
void
ReturnLog
([
FromBody
]
SignalrLogRequest
request
)
public
void
ReturnLog
([
FromBody
]
MessageInfo
request
)
{
logger
.
LogInformation
(
"返回日志:"
+
JsonHelper
.
Serialize
(
request
));
if
(
request
.
Type
==
3
)
{
logService
.
Schedule
(
request
.
GroupName
,
ConvertHelper
.
To
<
decimal
>(
request
.
Message
),
request
.
Level
);
}
else
{
logService
.
ExtractLog
(
request
.
GroupName
,
request
.
Tag
,
request
.
Message
,
request
.
Level
);
}
notificationsService
.
SendMessage
(
claim
.
GetUserId
(),
request
);
}
/// <summary>
...
...
performance/Performance.DtoModels/Hubs/SingleData.cs
0 → 100644
View file @
e36acb62
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
SingleData
{
public
string
Uuid
{
get
;
set
;
}
public
int
UserId
{
get
;
set
;
}
public
SingleData
()
{
}
public
SingleData
(
string
uuid
,
int
userId
)
{
Uuid
=
uuid
;
UserId
=
userId
;
}
}
}
performance/Performance.Services/AllotCompute/ImportDataService.cs
View file @
e36acb62
...
...
@@ -30,8 +30,7 @@ public class ImportDataService : IAutoInjection
private
PerforImspecialunitRepository
perforImspecialunitRepository
;
private
PerforImemployeeclinicRepository
perforImemployeeclinicRepository
;
private
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
;
//private PerforLogdbugRepository logdbug;
private
readonly
LogManageService
logManageService
;
private
readonly
NotificationsService
notificationsService
;
private
ILogger
<
ImportDataService
>
logger
;
public
ImportDataService
(
PerSheetService
perSheetService
,
...
...
@@ -44,8 +43,7 @@ public class ImportDataService : IAutoInjection
PerforImspecialunitRepository
perforImspecialunitRepository
,
PerforImemployeeclinicRepository
perforImemployeeclinicRepository
,
PerforImemployeelogisticsRepository
perforImemployeelogisticsRepository
,
//PerforLogdbugRepository logdbug
LogManageService
logManageService
,
NotificationsService
notificationsService
,
ILogger
<
ImportDataService
>
logger
)
{
this
.
perSheetService
=
perSheetService
;
...
...
@@ -58,8 +56,7 @@ public class ImportDataService : IAutoInjection
this
.
perforImspecialunitRepository
=
perforImspecialunitRepository
;
this
.
perforImemployeeclinicRepository
=
perforImemployeeclinicRepository
;
this
.
perforImemployeelogisticsRepository
=
perforImemployeelogisticsRepository
;
//this.logdbug = logdbug;
this
.
logManageService
=
logManageService
;
this
.
notificationsService
=
notificationsService
;
this
.
logger
=
logger
;
}
...
...
@@ -111,7 +108,7 @@ private PerExcel Import(per_allot allot)
}
if
(
SheetType
.
Unidentifiable
!=
sheetType
)
{
logManageService
.
WriteMsg
(
"开始读取excel文件"
,
$"开始读取sheet --
{
sheet
.
SheetName
}
"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"开始读取excel文件:开始读取sheet --
{
sheet
.
SheetName
}
"
);
try
{
var
st
=
perSheetService
.
Sheet
(
sheet
,
isnew
);
...
...
@@ -119,7 +116,7 @@ private PerExcel Import(per_allot allot)
}
catch
(
Exception
ex
)
{
logManageService
.
WriteMsg
(
"读取excel文件"
,
ex
.
Message
.
ToString
(),
4
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"读取excel文件:
{
ex
.
Message
}
。"
,
ComponentType
.
error
);
throw
ex
;
}
}
...
...
@@ -129,7 +126,7 @@ private PerExcel Import(per_allot allot)
isnew
=
true
;
}
}
logManageService
.
WriteMsg
(
"开始读取excel文件"
,
$"excel文件基础数据读取完成!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"开始读取excel文件:excel文件基础数据读取完成!"
);
return
excel
;
}
}
...
...
@@ -391,7 +388,7 @@ private bool Save(PerExcel excel, int allotId)
{
foreach
(
var
sheet
in
excel
.
PerSheet
)
{
logManageService
.
WriteMsg
(
"保存基础数据"
,
$"开始保存数据 --
{
sheet
.
SheetName
}
"
,
1
,
allotId
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"保存基础数据:开始保存数据 --
{
sheet
.
SheetName
}
。"
);
if
(
sheet
.
SheetType
==
SheetType
.
Employee
)
{
var
imsheetid
=
SaveEmployee
(
sheet
,
allotId
);
...
...
@@ -423,7 +420,7 @@ private bool Save(PerExcel excel, int allotId)
SaveHeader
(
sheet
,
allotId
,
imsheetid
);
}
}
logManageService
.
WriteMsg
(
"保存基础数据"
,
$"基础数据保存完成!"
,
1
,
allotId
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"保存基础数据:基础数据保存完成!"
);
return
true
;
}
}
...
...
performance/Performance.Services/AllotCompute/ProcessComputService.cs
View file @
e36acb62
...
...
@@ -27,7 +27,7 @@ public class ProcessComputService : IAutoInjection
private
PerforCofdrugtypeRepository
perforCofdrugtypeRepository
;
private
PerforCofworkitemRepository
perforCofworkitemRepository
;
private
readonly
PerforRescomputeRepository
perforRescomputeRepository
;
private
readonly
LogManageService
logManage
Service
;
private
readonly
NotificationsService
notifications
Service
;
private
readonly
GuaranteeService
guaranteeService
;
private
readonly
PerforHospitalRepository
hospitalRepository
;
private
readonly
PerforPerallotRepository
perallotRepository
;
...
...
@@ -44,7 +44,7 @@ public class ProcessComputService : IAutoInjection
PerforCofdrugtypeRepository
perforCofdrugtypeRepository
,
PerforCofworkitemRepository
perforCofworkitemRepository
,
PerforRescomputeRepository
perforRescomputeRepository
,
LogManageService
logManage
Service
,
NotificationsService
notifications
Service
,
GuaranteeService
guaranteeService
,
PerforHospitalRepository
hospitalRepository
,
PerforPerallotRepository
perallotRepository
)
...
...
@@ -60,7 +60,7 @@ public class ProcessComputService : IAutoInjection
this
.
perforCofdrugtypeRepository
=
perforCofdrugtypeRepository
;
this
.
perforCofworkitemRepository
=
perforCofworkitemRepository
;
this
.
perforRescomputeRepository
=
perforRescomputeRepository
;
this
.
logManageService
=
logManage
Service
;
this
.
notificationsService
=
notifications
Service
;
this
.
guaranteeService
=
guaranteeService
;
this
.
hospitalRepository
=
hospitalRepository
;
this
.
perallotRepository
=
perallotRepository
;
...
...
@@ -162,7 +162,7 @@ public void Save(List<PerSheet> perSheets, int allotId)
{
foreach
(
var
sheet
in
perSheets
)
{
logManageService
.
WriteMsg
(
"正在生成绩效"
,
$"保存核算数据 -
{
sheet
.
SheetName
}
"
,
1
,
allotId
,
"ReceiveMessage
"
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"正在生成绩效:保存核算数据 -
{
sheet
.
SheetName
}
"
);
if
(
sheet
.
SheetType
==
SheetType
.
ComputeDoctorAccount
||
sheet
.
SheetType
==
SheetType
.
ComputeNurseAccount
)
{
SaveComputeAccount
(
sheet
,
allotId
);
...
...
performance/Performance.Services/AllotService.cs
View file @
e36acb62
...
...
@@ -21,7 +21,6 @@ namespace Performance.Services
public
class
AllotService
:
IAutoInjection
{
private
BaiscNormService
baiscNormService
;
private
CheckDataService
checkDataService
;
private
ImportDataService
importDataService
;
private
ProcessComputService
processComputService
;
private
ResultComputeService
resultComputeService
;
...
...
@@ -44,16 +43,12 @@ public class AllotService : IAutoInjection
private
readonly
RoleService
roleService
;
private
readonly
UserService
userService
;
private
PerforCofdirectorRepository
perforCofdirectorRepository
;
//private readonly IHubContext<AllotLogHub> hubContext;
private
readonly
LogManageService
logManageService
;
private
readonly
NotificationsService
notificationsService
;
private
readonly
ReportService
reportService
;
private
readonly
QueryDataService
queryDataService
;
public
AllotService
(
PerforPerallotRepository
allotRepository
,
BaiscNormService
baiscNormService
,
CheckDataService
checkDataService
,
ImportDataService
importDataService
,
ProcessComputService
processComputService
,
ResultComputeService
resultComputeService
,
...
...
@@ -74,7 +69,7 @@ public class AllotService : IAutoInjection
//IHubContext<AllotLogHub> hubContext
RoleService
roleService
,
UserService
userService
,
LogManageService
logManage
Service
,
NotificationsService
notifications
Service
,
ReportService
reportService
,
PerforCofdirectorRepository
perforCofdirectorRepository
,
QueryDataService
queryDataService
)
...
...
@@ -84,7 +79,6 @@ public class AllotService : IAutoInjection
_logger
=
logger
;
_evn
=
evn
;
this
.
baiscNormService
=
baiscNormService
;
this
.
checkDataService
=
checkDataService
;
this
.
importDataService
=
importDataService
;
this
.
processComputService
=
processComputService
;
this
.
resultComputeService
=
resultComputeService
;
...
...
@@ -103,7 +97,7 @@ public class AllotService : IAutoInjection
this
.
roleService
=
roleService
;
this
.
userService
=
userService
;
//this.hubContext = hubContext;
this
.
logManageService
=
logManage
Service
;
this
.
notificationsService
=
notifications
Service
;
this
.
reportService
=
reportService
;
this
.
perforCofdirectorRepository
=
perforCofdirectorRepository
;
this
.
queryDataService
=
queryDataService
;
...
...
@@ -308,20 +302,20 @@ public void Generate(per_allot allot, string mail)
DateTime
time
=
DateTime
.
Now
;
try
{
logManageService
.
WriteMsg
(
"绩效开始执行"
,
$"正在生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效!"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"绩效开始执行:正在生成
{
allot
.
Year
}
-
{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
月份绩效!"
);
var
excel
=
new
PerExcel
();
int
generate
=
allot
.
Generate
;
if
(
new
int
[]
{
(
int
)
AllotGenerate
.
OriginalDataEdited
,
(
int
)
AllotGenerate
.
PersonnelOffice
}.
Contains
(
allot
.
Generate
))
{
logManageService
.
WriteMsg
(
"绩效开始执行"
,
$"数据来源:生成成功后被修改的原数据。"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"绩效开始执行:数据来源-生成成功后被修改的原数据。"
);
generate
=
(
int
)
AllotGenerate
.
Success
;
configService
.
ClearResData
(
allot
.
ID
);
excel
=
queryDataService
.
QueryDataAndHeader
(
allot
);
}
else
{
logManageService
.
WriteMsg
(
"绩效开始执行"
,
$"数据来源:用户上传的Excel。"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"绩效开始执行:数据来源-用户上传的Excel。"
);
configService
.
Clear
(
allot
.
ID
);
// 关闭筛选功能
...
...
@@ -330,13 +324,6 @@ public void Generate(per_allot allot, string mail)
excel
=
importDataService
.
ReadDataAndSave
(
allot
);
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InCheckData
,
EnumHelper
.
GetDescription
(
AllotStates
.
InCheckData
));
//if (!checkDataService.Check(excel, allot))
//{
// UpdateAllotStates(allot.ID, (int)AllotStates.CheckFail, EnumHelper.GetDescription(AllotStates.CheckFail));
// //SendEmail(allot, mail, 3, time);
// logManageService.WriteMsg("绩效数据校验失败", "详情可至“更多 -- 查看日志”查看", 3, allot.ID, "ReceiveMessage", true);
// return;
//}
}
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InGenerate
,
EnumHelper
.
GetDescription
(
AllotStates
.
InGenerate
));
...
...
@@ -348,7 +335,7 @@ public void Generate(per_allot allot, string mail)
//根据当前业绩绩效核算出最终绩效结果
//科室经济核算汇总、工作量汇总
logManageService
.
WriteMsg
(
"科室业绩汇总"
,
"正在生成科室收入支出汇总、工作量汇总"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"科室业绩汇总:正在生成科室收入支出汇总、工作量汇总。"
);
var
(
list
,
mergeSheets
)
=
processComputService
.
MergeCompute
(
excel
,
allot
.
ID
);
processComputService
.
Save
(
list
,
allot
.
ID
);
...
...
@@ -404,11 +391,11 @@ public void Generate(per_allot allot, string mail)
#
endregion
注释
//重新计算科室业绩(含所有提供保底金额)
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"计算科室业绩分"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:计算科室业绩分。"
);
var
sheetLast
=
processComputService
.
Compute
(
excel
,
mergeSheets
,
allot
);
//保存计算过程数据
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"保存科室业绩结果及计算过程中产生的数据"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:保存科室业绩结果及计算过程中产生的数据。"
);
processComputService
.
Save
(
sheetLast
,
allot
.
ID
);
////业务中层行政中高层医院奖罚
...
...
@@ -416,23 +403,23 @@ public void Generate(per_allot allot, string mail)
//var employeeExtra = processComputService.GetEmployeeExtra(excel);
// 计算最总数据
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"计算最终绩效数据"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:计算最终绩效数据。"
);
var
baiscnormList
=
resultComputeService
.
Compute
(
allot
,
sheetLast
);
// 计算行政科室绩效
processComputService
.
ComputeOffice
(
allot
,
excel
);
// 计算特殊科室
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"计算最终特殊科室绩效数据"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:计算最终特殊科室绩效数据。"
);
resultComputeService
.
SpecialUnitCompute
(
excel
,
allot
,
baiscnormList
);
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"保存最终特殊科室绩效数据"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:保存最终特殊科室绩效数据。"
);
//保存 绩效人均参考标准
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"保存绩效人均参考标准"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:保存绩效人均参考标准。"
);
perforResbaiscnormRepository
.
AddRange
(
baiscnormList
.
ToArray
());
// 保存预留绩效
logManageService
.
WriteMsg
(
"正在生成绩效"
,
"保存预留绩效金额"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成绩效:保存预留绩效金额。"
);
resultComputeService
.
SaveReserved
(
allot
);
// 科室下发
...
...
@@ -441,24 +428,20 @@ public void Generate(per_allot allot, string mail)
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateAccomplish
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateAccomplish
),
generate
);
perforCofdirectorRepository
.
SupplementaryData
(
allot
.
ID
);
logManageService
.
WriteMsg
(
"正在生成报表数据"
,
"正在生成报表数据"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"正在生成报表数据:正在生成报表数据。"
);
var
res
=
reportService
.
ImportData
(
allot
);
var
flag
=
reportService
.
UpdateData
(
allot
);
logManageService
.
WriteMsg
(
"正在生成报表数据"
,
$"报表数据生成完成;受影响:
{
res
}
行"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
////发送邮件
//logManageService.WriteMsg("正在发送邮件", "正在发送邮件", 1, allot.ID, "ReceiveMessage", true);
//SendEmail(allot, mail, 1, time);
//logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
logManageService
.
WriteMsg
(
"绩效生成结束"
,
"绩效生成成功"
,
5
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"绩效生成结束:绩效生成成功。"
,
ComponentType
.
success
);
}
catch
(
Exception
ex
)
{
logManageService
.
WriteMsg
(
"绩效生成失败"
,
ex
.
Message
,
4
,
allot
.
ID
,
"ReceiveMessage"
);
notificationsService
.
SendGenerateMessage
(
allot
.
ID
,
$"绩效生成失败:
{
ex
.
Message
}
。"
,
ComponentType
.
error
);
logdbug
.
Add
(
allot
.
ID
,
"绩效生成失败"
,
ex
.
ToString
(),
4
,
1
);
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateFail
));
//SendEmail(allot, mail, 2, time);
//throw ex;
}
finally
{
notificationsService
.
RemoveCache
(
NotificationsService
.
AllotGenerateKeyPrefix
+
allot
.
ID
);
}
}
...
...
performance/Performance.Services/ConfigService.cs
View file @
e36acb62
...
...
@@ -17,7 +17,6 @@ public class ConfigService : IAutoInjection
{
#
region
private
PerforCofdirectorRepository
_directorRepository
;
//private PerforCofdrugpropRepository _drugpropRepository;
private
PerforCofworkitemRepository
_workitemRepository
;
private
PerforCofagainRepository
_againRepository
;
private
PerforCofdrugtypeRepository
_drugtypeRepository
;
...
...
@@ -27,14 +26,12 @@ public class ConfigService : IAutoInjection
private
PerforImheaderRepository
perforImheaderRepository
;
private
PerforCofdepttypeRepository
perforCofdepttypeRepository
;
private
PerforPerapramountRepository
perapramountRepository
;
//private PerforCofcmiRepository perforCofcmiRepository;
private
PerforCofHrpDeptRepository
perforCofHrpDeptRepository
;
private
PersonService
personService
;
private
LogManageService
logManage
Service
;
private
NotificationsService
notifications
Service
;
private
ILogger
<
ConfigService
>
logger
;
public
ConfigService
(
PerforCofdirectorRepository
cofdirectorRepository
,
//PerforCofdrugpropRepository cofdrugpropRepository,
PerforCofagainRepository
againRepository
,
PerforCofdrugtypeRepository
drugtypeRepository
,
PerforPerallotRepository
perforPerAllotRepository
,
...
...
@@ -44,14 +41,12 @@ public class ConfigService : IAutoInjection
PerforImheaderRepository
perforImheaderRepository
,
PerforCofdepttypeRepository
perforCofdepttypeRepository
,
PerforPerapramountRepository
perapramountRepository
,
//PerforCofcmiRepository perforCofcmiRepository,
PerforCofHrpDeptRepository
perforCofHrpDeptRepository
,
PersonService
personService
,
LogManageService
logManage
Service
,
NotificationsService
notifications
Service
,
ILogger
<
ConfigService
>
logger
)
{
this
.
_directorRepository
=
cofdirectorRepository
;
//this._drugpropRepository = cofdrugpropRepository;
this
.
_workitemRepository
=
workitemRepository
;
this
.
_againRepository
=
againRepository
;
this
.
_drugtypeRepository
=
drugtypeRepository
;
...
...
@@ -64,7 +59,7 @@ public class ConfigService : IAutoInjection
//this.perforCofcmiRepository = perforCofcmiRepository;
this
.
perforCofHrpDeptRepository
=
perforCofHrpDeptRepository
;
this
.
personService
=
personService
;
this
.
logManageService
=
logManage
Service
;
this
.
notificationsService
=
notifications
Service
;
this
.
logger
=
logger
;
}
...
...
@@ -753,7 +748,7 @@ public void Copy(per_allot allot)
public
void
Clear
(
int
allotId
)
{
var
count
=
_directorRepository
.
DeleteData
(
allotId
);
logManageService
.
WriteMsg
(
"清理无效数据"
,
$"清理无效数据,受影响行数:
{
count
}
"
,
1
,
allotId
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"清理无效数据:清理无效数据,受影响行数:
{
count
}
。"
);
}
/// <summary>
...
...
@@ -763,7 +758,7 @@ public void Clear(int allotId)
public
void
ClearAllotData
(
int
allotId
)
{
var
count
=
_directorRepository
.
DeleteAllotData
(
allotId
);
logManageService
.
WriteMsg
(
"清理无效数据"
,
$"清理无效数据,受影响行数:
{
count
}
"
,
1
,
allotId
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"清理无效数据:清理无效数据,受影响行数:
{
count
}
。"
);
}
/// <summary>
...
...
@@ -773,7 +768,7 @@ public void ClearAllotData(int allotId)
public
void
ClearResData
(
int
allotId
)
{
var
count
=
_directorRepository
.
DeleteResData
(
allotId
);
logManageService
.
WriteMsg
(
"清理无效数据"
,
$"清理无效数据,受影响行数:
{
count
}
"
,
1
,
allotId
,
"ReceiveMessage"
,
true
);
notificationsService
.
SendGenerateMessage
(
allotId
,
$"清理无效数据:清理无效数据,受影响行数:
{
count
}
。"
);
}
/// <summary>
...
...
@@ -783,7 +778,7 @@ public void ClearResData(int allotId)
public
void
ClearAgain
(
int
againId
)
{
var
count
=
_directorRepository
.
DelAgain
(
againId
);
logManageService
.
WriteMsg
(
"清理无效数据"
,
$"清除二次绩效中无效数据,受影响行数:
{
count
}
"
,
1
,
againId
,
"ReceiveMessage"
,
true
);
//notificationsService.SendGenerateMessage(againId, $"清理无效数据:清除二次绩效中无效数据,受影响行数:{count}。"
);
}
#
endregion
...
...
@@ -838,7 +833,7 @@ private void CopyAprData(int prevAllotId, int allotId)
}
}
public
HandsonTable
GetHrpDeptHands
(
int
HospitalId
,
int
AllotId
)
public
HandsonTable
GetHrpDeptHands
(
int
HospitalId
,
int
AllotId
)
{
var
result
=
new
HandsonTable
((
int
)
SheetType
.
Unidentifiable
,
HrpDept
.
Select
(
t
=>
t
.
Value
).
ToArray
(),
HrpDept
.
Select
(
t
=>
new
collect_permission
{
...
...
@@ -858,7 +853,7 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
var
firstDic
=
JsonHelper
.
Deserialize
<
Dictionary
<
string
,
string
>>(
json
);
var
cells
=
(
from
conf
in
HrpDept
join
fst
in
firstDic
on
conf
.
Key
.
ToUpper
()
equals
fst
.
Key
.
ToUpper
()
select
new
HandsonCellData
(
conf
.
Value
,
fst
.
Value
)).
ToList
();
rowDatas
.
Add
(
new
HandsonRowData
(
i
,
cells
));
i
++;
}
...
...
@@ -866,9 +861,9 @@ public HandsonTable GetHrpDeptHands(int HospitalId,int AllotId)
return
result
;
}
public
void
SaveDepttypeHands
(
int
hospitalId
,
int
allotId
,
SaveCollectData
request
)
public
void
SaveDepttypeHands
(
int
hospitalId
,
int
allotId
,
SaveCollectData
request
)
{
var
dicData
=
CreateDataRow
(
hospitalId
,
allotId
,
request
,
HrpDept
);
var
dicData
=
CreateDataRow
(
hospitalId
,
allotId
,
request
,
HrpDept
);
List
<
cof_hrp_department
>
depts
=
new
List
<
cof_hrp_department
>();
foreach
(
var
item
in
dicData
)
...
...
@@ -884,7 +879,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
}
perforCofHrpDeptRepository
.
Execute
(
"delete from cof_hrp_department where HospitalId=@hospitalId and allotid = @allotid"
,
new
{
hospitalId
,
allotId
});
,
new
{
hospitalId
,
allotId
});
perforCofHrpDeptRepository
.
AddRange
(
depts
.
ToArray
());
}
...
...
@@ -897,7 +892,7 @@ public void SaveDepttypeHands(int hospitalId, int allotId,SaveCollectData reques
// 创建固定数据列
Dictionary
<
string
,
string
>
baseData
=
CreateBaseData
(
request
,
config
,
r
);
baseData
.
Add
(
nameof
(
cof_hrp_department
.
AllotId
),
allotId
.
ToString
());
baseData
.
Add
(
nameof
(
cof_hrp_department
.
HospitalId
),
hospitalId
.
ToString
());
baseData
.
Add
(
nameof
(
cof_hrp_department
.
HospitalId
),
hospitalId
.
ToString
());
allData
.
Add
(
baseData
);
}
...
...
performance/Performance.Services/Hubs/AllotLogHub.cs
View file @
e36acb62
...
...
@@ -13,29 +13,22 @@ namespace Performance.Services
[
Authorize
]
public
class
AllotLogHub
:
Hub
{
private
readonly
IMemoryCache
cache
;
private
readonly
ILogger
<
AllotLogHub
>
logger
;
private
readonly
NotificationsService
service
;
public
AllotLogHub
(
I
MemoryCache
cache
,
ILogger
<
AllotLogHub
>
logger
I
Logger
<
AllotLogHub
>
logger
,
NotificationsService
service
)
{
this
.
cache
=
cache
;
this
.
logger
=
logger
;
this
.
service
=
service
;
}
public
override
Task
OnConnectedAsync
()
{
string
key
=
Context
.
User
.
Claims
.
FirstOrDefault
(
t
=>
t
.
Type
==
"id"
)?.
Value
;
if
(!
string
.
IsNullOrEmpty
(
key
))
{
if
(
cache
.
TryGetValue
(
key
,
out
_
))
{
cache
.
Remove
(
key
);
}
cache
.
Set
(
key
,
Context
.
ConnectionId
);
}
service
.
SetCache
(
key
,
Context
.
ConnectionId
);
logger
.
LogInformation
(
$"用户在
{
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日 hh时mm分ss秒"
)}
创建连接"
);
return
base
.
OnConnectedAsync
();
}
...
...
@@ -43,13 +36,7 @@ public override Task OnConnectedAsync()
public
override
Task
OnDisconnectedAsync
(
Exception
exception
)
{
string
key
=
Context
.
User
.
Claims
.
FirstOrDefault
(
t
=>
t
.
Type
==
"id"
)?.
Value
;
if
(!
string
.
IsNullOrEmpty
(
key
))
{
if
(
cache
.
TryGetValue
(
key
,
out
_
))
{
cache
.
Remove
(
key
);
}
}
service
.
RemoveCache
(
key
);
logger
.
LogInformation
(
$"用户在
{
DateTime
.
Now
.
ToString
(
"yyyy年MM月dd日 hh时mm分ss秒"
)}
断开连接"
);
return
base
.
OnDisconnectedAsync
(
exception
);
}
...
...
performance/Performance.Services/Hubs/NotificationsService.cs
View file @
e36acb62
...
...
@@ -32,18 +32,30 @@ PerforLogdsignalrRepository repository
this
.
repository
=
repository
;
}
public
void
SendGenerateMessage
(
int
userId
,
int
allotId
,
string
message
,
ComponentType
type
=
ComponentType
.
info
)
public
const
string
AllotGenerateKeyPrefix
=
"Allot-Generate-"
;
public
void
SendGenerateMessage
(
int
allotId
,
string
message
,
ComponentType
type
=
ComponentType
.
info
)
{
var
info
=
new
MessageInfo
(
""
,
allotId
,
"生成绩效"
,
message
,
Component
.
Notification
,
type
);
SendMessage
(
userId
,
info
);
}
var
data
=
GetCache
<
SingleData
>(
AllotGenerateKeyPrefix
+
allotId
);
if
(
data
==
null
||
data
.
UserId
==
0
)
return
;
var
info
=
new
MessageInfo
(
data
.
Uuid
,
allotId
,
"生成绩效"
,
message
,
Component
.
Notification
,
type
);
SendMessage
(
data
.
UserId
,
info
);
}
public
void
SendMessage
(
int
userId
,
MessageInfo
data
)
{
string
key
=
userId
.
ToString
();
if
(
cache
.
TryGetValue
(
key
,
out
string
connectionId
)
&&
!
string
.
IsNullOrEmpty
(
connectionId
))
{
if
(
data
.
Component
==
Component
.
Progress
)
{
var
percentage
=
ConvertHelper
.
To
<
decimal
>(
data
.
Message
);
data
.
Message
=
(
data
.
Status
==
ComponentType
.
success
?
100
:
(
data
.
Status
!=
ComponentType
.
success
&&
percentage
>=
100
)
?
99
:
percentage
).
ToString
();
}
SendMessageToClient
(
connectionId
,
data
);
}
}
...
...
@@ -57,5 +69,64 @@ private void SendMessageToClient(string connectionId, MessageInfo data, string m
{
hubContext
.
Clients
.
Client
(
connectionId
).
SendAsync
(
method
,
data
.
Title
,
data
);
}
#
region
缓存
/// <summary>
/// 添加缓存
/// </summary>
/// <param name="key">缓存Key</param>
/// <param name="value">缓存Value</param>
public
void
SetCache
(
string
key
,
object
value
)
{
if
(!
string
.
IsNullOrEmpty
(
key
))
{
if
(
cache
.
TryGetValue
(
key
,
out
_
))
{
cache
.
Remove
(
key
);
}
cache
.
Set
(
key
,
value
);
}
}
/// <summary>
/// 删除缓存
/// </summary>
/// <param name="key">缓存Key</param>
public
void
RemoveCache
(
string
key
)
{
if
(!
string
.
IsNullOrEmpty
(
key
))
{
cache
.
Remove
(
key
);
}
}
/// <summary>
/// 获取缓存
/// </summary>
/// <param name="key">缓存Key</param>
/// <returns></returns>
public
T
GetCache
<
T
>(
string
key
)
where
T
:
class
{
if
(
key
==
null
)
throw
new
ArgumentNullException
(
nameof
(
key
));
return
cache
.
Get
(
key
)
as
T
;
}
/// <summary>
/// 获取缓存
/// </summary>
/// <param name="key">缓存Key</param>
/// <returns></returns>
public
object
GetCache
(
string
key
)
{
if
(
key
==
null
)
throw
new
ArgumentNullException
(
nameof
(
key
));
return
cache
.
Get
(
key
);
}
#
endregion
}
}
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