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
2c120c9b
Commit
2c120c9b
authored
Jun 28, 2019
by
799284587@qq.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
http://192.168.0.110:8880/zry/performance
into develop
parents
391ec465
03c1e62f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
147 additions
and
2 deletions
+147
-2
performance/Performance.Api/Controllers/TemplateController.cs
+8
-1
performance/Performance.EntityModels/Entity/per_allot.cs
+5
-0
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+4
-0
performance/Performance.Extract.Api/Performance.Extract.Api.csproj
+1
-0
performance/Performance.Extract.Api/Startup.cs
+3
-1
performance/Performance.Extract.Api/nlog.config
+60
-0
performance/Performance.Infrastructure/Helper/HttpHelper.cs
+54
-0
performance/Performance.Services/ExtractService.cs
+12
-0
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
2c120c9b
...
@@ -113,6 +113,9 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
...
@@ -113,6 +113,9 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
var
allot
=
allotService
.
GetAllot
(
request
.
ID
);
var
allot
=
allotService
.
GetAllot
(
request
.
ID
);
if
(
allot
==
null
)
if
(
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该绩效无效"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"该绩效无效"
);
allot
.
IsExtracting
=
allot
.
IsExtracting
??
0
;
if
(
allot
.
IsExtracting
==
1
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"正在提取数据,请稍等。"
);
var
hospital
=
hospitalService
.
GetHopital
(
request
.
HospitalId
.
Value
);
var
hospital
=
hospitalService
.
GetHopital
(
request
.
HospitalId
.
Value
);
if
(
hospital
==
null
)
if
(
hospital
==
null
)
...
@@ -125,7 +128,10 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
...
@@ -125,7 +128,10 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
mail
=
user
.
Mail
,
mail
=
user
.
Mail
,
hospitalId
=
hospital
.
ID
hospitalId
=
hospital
.
ID
});
});
HttpHelper
.
HttpPost
(
url
.
ExtractData
,
param
,
true
);
allot
.
IsExtracting
=
1
;
allotService
.
Update
(
allot
);
HttpHelper
.
HttpPostNoRequest
(
url
.
ExtractData
,
param
,
true
);
//extractService.ExtractData(request.ID, user.Mail, hospital);
//extractService.ExtractData(request.ID, user.Mail, hospital);
//BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
//BackgroundJob.Enqueue(() => extractService.ExtractData(request.ID, user.Mail, hospital));
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
...
@@ -183,6 +189,7 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
...
@@ -183,6 +189,7 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
}
}
var
allot
=
allotService
.
GetAllot
(
allotId
);
var
allot
=
allotService
.
GetAllot
(
allotId
);
allot
.
ExtractPath
=
path
;
allot
.
ExtractPath
=
path
;
allot
.
IsExtracting
=
2
;
if
(!
string
.
IsNullOrEmpty
(
path
)
&&
allotService
.
Update
(
allot
))
if
(!
string
.
IsNullOrEmpty
(
path
)
&&
allotService
.
Update
(
allot
))
return
new
ApiResponse
(
ResponseType
.
OK
,
"上传成功!"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"上传成功!"
);
else
else
...
...
performance/Performance.EntityModels/Entity/per_allot.cs
View file @
2c120c9b
...
@@ -75,5 +75,10 @@ public class per_allot
...
@@ -75,5 +75,10 @@ public class per_allot
/// 提取绩效数据文件生成路径
/// 提取绩效数据文件生成路径
/// </summary>
/// </summary>
public
string
ExtractPath
{
get
;
set
;
}
public
string
ExtractPath
{
get
;
set
;
}
/// <summary>
/// 是否在抽取数据0 否、1 是、2 抽取成功、3 抽取失败
/// </summary>
public
Nullable
<
int
>
IsExtracting
{
get
;
set
;
}
}
}
}
}
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
2c120c9b
...
@@ -35,6 +35,8 @@ public class ExtractController : Controller
...
@@ -35,6 +35,8 @@ public class ExtractController : Controller
[
Route
(
"index"
)]
[
Route
(
"index"
)]
public
void
Index
([
FromBody
]
AllotRequest
request
)
public
void
Index
([
FromBody
]
AllotRequest
request
)
{
{
var
token
=
Guid
.
NewGuid
().
ToString
(
"N"
);
logger
.
LogInformation
(
token
+
",开始提取数据,请求参数:"
+
JsonHelper
.
Serialize
(
request
));
var
hospital
=
hospitalService
.
GetHopital
(
request
.
HospitalId
.
Value
);
var
hospital
=
hospitalService
.
GetHopital
(
request
.
HospitalId
.
Value
);
var
filepath
=
extractService
.
ExtractData
(
request
.
ID
,
request
.
Mail
,
hospital
);
var
filepath
=
extractService
.
ExtractData
(
request
.
ID
,
request
.
Mail
,
hospital
);
if
(!
string
.
IsNullOrEmpty
(
filepath
)
&&
FileHelper
.
IsExistFile
(
filepath
))
if
(!
string
.
IsNullOrEmpty
(
filepath
)
&&
FileHelper
.
IsExistFile
(
filepath
))
...
@@ -51,6 +53,7 @@ public void Index([FromBody]AllotRequest request)
...
@@ -51,6 +53,7 @@ public void Index([FromBody]AllotRequest request)
i
++;
i
++;
}
}
}
}
logger
.
LogInformation
(
token
+
",提取结束,请求参数:"
+
JsonHelper
.
Serialize
(
request
));
}
}
}
}
}
}
\ No newline at end of file
performance/Performance.Extract.Api/Performance.Extract.Api.csproj
View file @
2c120c9b
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.5.1" />
<PackageReference Include="NLog.Extensions.Logging" Version="1.5.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.8.0" />
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ItemGroup>
...
...
performance/Performance.Extract.Api/Startup.cs
View file @
2c120c9b
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Microsoft.Extensions.Options
;
using
NLog.Extensions.Logging
;
using
NLog.Extensions.Logging
;
using
NLog.Web
;
using
Performance.DtoModels.AppSettings
;
using
Performance.DtoModels.AppSettings
;
using
Performance.DtoModels.AutoMapper
;
using
Performance.DtoModels.AutoMapper
;
using
Performance.EntityModels
;
using
Performance.EntityModels
;
...
@@ -27,8 +28,9 @@ namespace Performance.Extract.Api
...
@@ -27,8 +28,9 @@ namespace Performance.Extract.Api
{
{
public
class
Startup
public
class
Startup
{
{
public
Startup
(
IConfiguration
configuration
)
public
Startup
(
IConfiguration
configuration
,
IHostingEnvironment
env
)
{
{
env
.
ConfigureNLog
(
"nlog.config"
);
Configuration
=
configuration
;
Configuration
=
configuration
;
}
}
...
...
performance/Performance.Extract.Api/nlog.config
0 → 100644
View file @
2c120c9b
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
nlog
xmlns
=
"http://www.nlog-project.org/schemas/NLog.xsd"
xmlns
:
xsi
=
"http://www.w3.org/2001/XMLSchema-instance"
autoReload
=
"true"
internalLogLevel
=
"info"
internalLogFile
=
"c:\Temp\GrapefruitVuCore\internal-nlog.txt"
>
<!--
enable
asp
.
net
core
and
mongodb
layout
renderers
-->
<
extensions
>
<
add
assembly
=
"NLog.Web.AspNetCore"
/>
<
add
assembly
=
"NLog.Mongo"
/>
</
extensions
>
<!--
internal
-
nlog
:
NLog
启动及加载
config
信息-->
<!--
nlog
-
all
:所有日志记录信息-->
<!--
nlog
-
own
:自定义日志记录信息-->
<!--
the
targets
to
write
to
-->
<
targets
>
<!--
write
logs
to
file
-->
<
target
xsi
:
type
=
"File"
name
=
"allfile"
fileName
=
"${basedir}/Logs/${shortdate}/${level}.log"
layout
=
"日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}==============================================================${newline}"
/>
<!--
another
file
log
,
only
own
logs
.
Uses
some
ASP
.
NET
core
renderers
-->
<
target
xsi
:
type
=
"File"
name
=
"ownFile-web"
fileName
=
"${basedir}/Logs/${shortdate}/${level}.log"
layout
=
"日志记录时间:${longdate}${newline}日志级别:${uppercase:${level}}${newline}日志来源:${logger}${newline}日志信息:${message}${newline}错误信息:${exception:format=tostring}${newline}url: ${aspnet-request-url}${newline}action: ${aspnet-mvc-action}${newline}==============================================================${newline}"
/>
<!--
write
log
to
mongodb
-->
<!--<
target
xsi
:
type
=
"Mongo"
name
=
"mongo"
databaseName
=
"nlog"
collectionName
=
"Logs"
connectionString
=
"mongodb://172.31.216.37:27017/nlog"
cappedCollectionSize
=
"26214400"
>
<
property
name
=
"LongDate"
layout
=
"${longdate}"
bsonType
=
"DateTime"
/>
<
property
name
=
"Level"
layout
=
"${level}"
/>
<
property
name
=
"Logger"
layout
=
"${logger}"
/>
<
property
name
=
"Message"
layout
=
"${message}"
/>
<
property
name
=
"Exception"
layout
=
"${exception:format=tostring}"
/>
<
property
name
=
"Url"
layout
=
"${aspnet-request-url}"
/>
<
property
name
=
"Action"
layout
=
"${aspnet-mvc-action}"
/>
<
property
name
=
"UserName"
layout
=
"${windows-identity}"
/>
</
target
>-->
</
targets
>
<!--
rules
to
map
from
logger
name
to
target
-->
<
rules
>
<!--
All
logs
,
including
from
Microsoft
-->
<
logger
name
=
"*"
minlevel
=
"Trace"
writeTo
=
"allfile"
/>
<!--
Skip
non
-
critical
Microsoft
logs
and
so
log
only
own
logs
-->
<
logger
name
=
"Microsoft.*"
maxLevel
=
"Info"
final
=
"true"
/>
<!--
BlackHole
without
writeTo
-->
<
logger
name
=
"*"
minlevel
=
"Trace"
writeTo
=
"ownFile-web"
/>
<!--
Add
logs
to
mongodb
-->
<!--<
logger
name
=
"*"
minlevel
=
"Trace"
writeTo
=
"mongo"
/>-->
</
rules
>
</
nlog
>
\ No newline at end of file
performance/Performance.Infrastructure/Helper/HttpHelper.cs
View file @
2c120c9b
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
using
System.Net.Security
;
using
System.Net.Security
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Security.Cryptography.X509Certificates
;
using
System.Text
;
using
System.Text
;
using
System.Threading
;
namespace
Performance.Infrastructure
namespace
Performance.Infrastructure
{
{
...
@@ -108,6 +109,59 @@ public static bool CheckValidationResult(object sender, X509Certificate certific
...
@@ -108,6 +109,59 @@ public static bool CheckValidationResult(object sender, X509Certificate certific
return
true
;
return
true
;
}
}
#
region
发送
post
请求
/// <summary>
/// 发送post请求
/// </summary>
/// <param name="Url"></param>
/// <param name="postDataStr"></param>
/// <returns></returns>
public
static
void
HttpPostNoRequest
(
string
Url
,
string
postDataStr
,
bool
IsJson
=
false
)
{
HttpWebResponse
response
=
null
;
HttpWebRequest
request
=
null
;
if
(
Url
.
ToLower
().
StartsWith
(
"https"
))
ServicePointManager
.
ServerCertificateValidationCallback
=
new
RemoteCertificateValidationCallback
(
CheckValidationResult
);
//验证服务器证书回调自动验证
try
{
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
System
.
GC
.
Collect
();
request
=
(
HttpWebRequest
)
WebRequest
.
Create
(
Url
);
request
.
Method
=
"POST"
;
request
.
KeepAlive
=
false
;
request
.
ProtocolVersion
=
HttpVersion
.
Version10
;
if
(
IsJson
)
request
.
ContentType
=
"application/json"
;
else
request
.
ContentType
=
"application/x-www-form-urlencoded"
;
byte
[]
bData
=
(
Encoding
.
UTF8
.
GetBytes
(
postDataStr
));
request
.
ContentLength
=
bData
.
Length
;
Stream
writeStream
=
request
.
GetRequestStream
();
writeStream
.
Write
(
bData
,
0
,
bData
.
Length
);
writeStream
.
Close
();
request
.
GetResponseAsync
();
Thread
.
Sleep
(
1000
);
}
catch
(
Exception
ex
)
{
throw
ex
;
}
finally
{
if
(
request
!=
null
)
request
.
Abort
();
if
(
response
!=
null
)
response
.
Close
();
}
}
#
endregion
发送
post
请求
/// <summary>
/// <summary>
/// 请求文件 post file
/// 请求文件 post file
/// </summary>
/// </summary>
...
...
performance/Performance.Services/ExtractService.cs
View file @
2c120c9b
...
@@ -144,6 +144,12 @@ public string ExtractData(int allotId, string mail, sys_hospital hospital)
...
@@ -144,6 +144,12 @@ public string ExtractData(int allotId, string mail, sys_hospital hospital)
logger
.
LogError
(
ex
.
ToString
());
logger
.
LogError
(
ex
.
ToString
());
LogHelper
.
Error
(
ex
.
ToString
(),
"提取绩效数据"
,
"异常"
);
LogHelper
.
Error
(
ex
.
ToString
(),
"提取绩效数据"
,
"异常"
);
SendEmail
(
mail
,
""
,
$"
{
hospital
.
HosName
}
HIS数据提取失败"
,
$"
{
hospital
.
HosName
}
提取数据失败,
{
ex
.
Message
}
!"
);
SendEmail
(
mail
,
""
,
$"
{
hospital
.
HosName
}
HIS数据提取失败"
,
$"
{
hospital
.
HosName
}
提取数据失败,
{
ex
.
Message
}
!"
);
var
allot
=
perforPerallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
if
(
allot
!=
null
)
{
allot
.
IsExtracting
=
3
;
perforPerallotRepository
.
Update
(
allot
);
}
throw
ex
;
throw
ex
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
@@ -151,6 +157,12 @@ public string ExtractData(int allotId, string mail, sys_hospital hospital)
...
@@ -151,6 +157,12 @@ public string ExtractData(int allotId, string mail, sys_hospital hospital)
logger
.
LogError
(
ex
.
ToString
());
logger
.
LogError
(
ex
.
ToString
());
LogHelper
.
Error
(
ex
.
ToString
(),
"提取绩效数据"
,
"异常"
);
LogHelper
.
Error
(
ex
.
ToString
(),
"提取绩效数据"
,
"异常"
);
SendEmail
(
mail
,
""
,
$"
{
hospital
.
HosName
}
HIS数据提取失败"
,
$"
{
hospital
.
HosName
}
提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!"
);
SendEmail
(
mail
,
""
,
$"
{
hospital
.
HosName
}
HIS数据提取失败"
,
$"
{
hospital
.
HosName
}
提取数据过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!"
);
var
allot
=
perforPerallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
allotId
);
if
(
allot
!=
null
)
{
allot
.
IsExtracting
=
3
;
perforPerallotRepository
.
Update
(
allot
);
}
throw
ex
;
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