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
05f68db2
Commit
05f68db2
authored
Aug 20, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
部分日志调整
parent
545565d3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
13 deletions
+30
-13
performance/Performance.Api/Startup.cs
+1
-1
performance/Performance.Extract.Api/Startup.cs
+18
-0
performance/Performance.Services/AllotService.cs
+3
-3
performance/Performance.Services/Hubs/AllotLogHub.cs
+5
-6
performance/Performance.Services/LogManageService.cs
+1
-1
performance/Performance.Services/NewExtractService.cs
+2
-2
No files found.
performance/Performance.Api/Startup.cs
View file @
05f68db2
...
...
@@ -231,7 +231,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
#
endregion
app
.
UseCors
(
"SignalrCore"
);
app
.
UseSignalR
(
routes
=>
routes
.
MapHub
<
AllotLogHub
>(
"/allotLogHub"
));
app
.
UseSignalR
(
routes
=>
routes
.
MapHub
<
AllotLogHub
>(
"/
performance/
allotLogHub"
));
loggerFactory
.
CreateLogger
<
Startup
>().
LogDebug
(
env
.
EnvironmentName
);
app
.
UseMvc
();
...
...
performance/Performance.Extract.Api/Startup.cs
View file @
05f68db2
...
...
@@ -99,6 +99,11 @@ public void ConfigureServices(IServiceCollection services)
services
.
AddAutoMapper
();
#
endregion
#
region
redis
var
csredis
=
new
CSRedis
.
CSRedisClient
(
connection
.
Value
.
RedisConnectionString
);
RedisHelper
.
Initialization
(
csredis
);
#
endregion
#
region
email
//阿里邮箱配置
...
...
@@ -119,6 +124,15 @@ public void ConfigureServices(IServiceCollection services)
options
.
UseMySQL
(
connection
.
Value
.
PerformanceConnectionString
);
});
#
endregion
services
.
AddSignalR
();
services
.
AddCors
(
options
=>
{
options
.
AddPolicy
(
"SignalrCore"
,
policy
=>
{
policy
.
SetIsOriginAllowed
(
origin
=>
true
).
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
();
});
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
...
@@ -130,6 +144,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
{
app
.
UseDeveloperExceptionPage
();
}
app
.
UseCors
(
"SignalrCore"
);
app
.
UseSignalR
(
routes
=>
routes
.
MapHub
<
AllotLogHub
>(
"/allotLogHub"
));
loggerFactory
.
CreateLogger
<
Startup
>().
LogDebug
(
env
.
EnvironmentName
);
app
.
UseMvc
();
}
...
...
performance/Performance.Services/AllotService.cs
View file @
05f68db2
...
...
@@ -246,14 +246,14 @@ public void Generate(per_allot allot, string mail)
//发送邮件
SendEmail
(
allot
,
mail
,
1
,
time
);
//logdbug.Add(allot.ID, "绩效开始执行", "绩效生成成功");
logManageService
.
WriteMsg
(
"绩效生成结束"
,
"绩效生成成功"
,
1
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
logManageService
.
WriteMsg
(
"绩效生成结束"
,
"绩效生成成功"
,
5
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
}
catch
(
Exception
ex
)
{
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateFail
));
SendEmail
(
allot
,
mail
,
2
,
time
);
//logdbug.Add(allot.ID, "绩效开始执行", ex.ToString()
);
logManageService
.
WriteMsg
(
"绩效生成失败"
,
ex
.
ToString
(),
4
,
allot
.
ID
,
"ReceiveMessage"
,
true
);
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
ex
.
ToString
(),
4
);
logManageService
.
WriteMsg
(
"绩效生成失败"
,
"程序异常,请重新尝试。"
,
4
,
allot
.
ID
,
"ReceiveMessage"
);
//throw ex;
}
}
...
...
performance/Performance.Services/Hubs/AllotLogHub.cs
View file @
05f68db2
...
...
@@ -7,7 +7,6 @@
namespace
Performance.Services
{
//[Authorize(Policy = "allotLogHub")]
public
class
AllotLogHub
:
Hub
{
public
override
Task
OnConnectedAsync
()
...
...
@@ -21,10 +20,10 @@ public override Task OnDisconnectedAsync(Exception exception)
var
groupName
=
""
;
//2 删除数据库中用户分组数据
if
(
RedisHelper
.
HExists
(
"
My
Group"
,
connectionId
))
if
(
RedisHelper
.
HExists
(
"
AllotLog
Group"
,
connectionId
))
{
groupName
=
RedisHelper
.
HGet
(
"
My
Group"
,
connectionId
);
RedisHelper
.
HDel
(
"
My
Group"
,
connectionId
);
groupName
=
RedisHelper
.
HGet
(
"
AllotLog
Group"
,
connectionId
);
RedisHelper
.
HDel
(
"
AllotLog
Group"
,
connectionId
);
}
//3 分组中删除用户
...
...
@@ -35,10 +34,10 @@ public override Task OnDisconnectedAsync(Exception exception)
public
async
Task
AddGroup
(
string
token
,
string
groupName
)
{
var
connectionId
=
Context
.
ConnectionId
;
if
(!
RedisHelper
.
HExists
(
"
My
Group"
,
connectionId
))
if
(!
RedisHelper
.
HExists
(
"
AllotLog
Group"
,
connectionId
))
{
//1 向数据库中插入用户及分组信息
RedisHelper
.
HSet
(
"
My
Group"
,
connectionId
,
groupName
);
RedisHelper
.
HSet
(
"
AllotLog
Group"
,
connectionId
,
groupName
);
//2 将用户插入分组
...
...
performance/Performance.Services/LogManageService.cs
View file @
05f68db2
...
...
@@ -23,7 +23,7 @@ public class LogManageService : IAutoInjection
/// </summary>
/// <param name="tag">标签</param>
/// <param name="message">内容</param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)</param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)
5、成功(success)
</param>
/// <param name="allotId">绩效Id</param>
/// <param name="method">方法名称</param>
public
void
WriteMsg
(
string
tag
,
string
message
,
int
level
,
int
allotId
,
string
method
,
bool
isDebug
=
false
)
...
...
performance/Performance.Services/NewExtractService.cs
View file @
05f68db2
...
...
@@ -164,14 +164,14 @@ public string ExtractData(int allotId, string email, int hospitalId)
{
workbook
.
Write
(
file
);
}
logManageService
.
WriteMsg
(
"提取绩效数据"
,
$"
{
hospital
.
HosName
}
HIS数据提取成功,文件路径:
{
newPath
}
。"
,
1
,
allotId
,
"ReceiveMessage"
);
logManageService
.
WriteMsg
(
"提取绩效数据"
,
$"
{
hospital
.
HosName
}
HIS数据提取成功,文件路径:
{
newPath
}
。"
,
5
,
allotId
,
"ReceiveMessage"
);
LogHelper
.
Information
(
$"
{
hospital
.
HosName
}
HIS数据提取成功,文件路径:
{
newPath
}
。"
,
"提取绩效数据"
);
SendEmail
(
email
,
newPath
,
$"
{
hospital
.
HosName
}
HIS数据提取成功"
,
$"
{
hospital
.
HosName
}
在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
成功提取。"
);
return
newPath
;
}
catch
(
Exception
ex
)
{
logManageService
.
WriteMsg
(
"提取数据异常"
,
$"数据写入出现异常
{
ex
.
ToString
()}
"
,
4
,
allotId
,
"ReceiveMessage"
);
logManageService
.
WriteMsg
(
"提取数据异常"
,
$"数据写入出现异常"
,
4
,
allotId
,
"ReceiveMessage"
);
LogHelper
.
Error
(
$"数据写入出现异常
{
ex
.
ToString
()}
"
,
"提取绩效数据"
,
"异常"
);
SendEmail
(
email
,
""
,
$"
{
hospital
.
HosName
}
HIS数据提取失败"
,
$"
{
hospital
.
HosName
}
提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!"
);
throw
ex
;
...
...
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