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
2ddb327b
Commit
2ddb327b
authored
Mar 09, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
额外收入抽取,webclient异步传递文件
parent
b932b898
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
5 deletions
+37
-5
performance/Performance.Api/Controllers/TemplateController.cs
+2
-1
performance/Performance.Infrastructure/Helper/HttpHelper.cs
+7
-1
performance/Performance.Services/DFExtractService.cs
+28
-3
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
2ddb327b
...
...
@@ -236,10 +236,11 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody]ExtractRequest r
//request.Email = claim.GetUserClaim(JwtClaimTypes.Mail);
logger
.
LogInformation
(
"提取绩效数据请求路径:"
+
url
.
HttpPost
+
"/extract/extract"
);
//HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true);
if
(
string
.
IsNullOrEmpty
(
filePath
))
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
"
,
""
);
else
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
"
,
filePath
);
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
"
,
filePath
,
true
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
}
...
...
performance/Performance.Infrastructure/Helper/HttpHelper.cs
View file @
2ddb327b
...
...
@@ -168,7 +168,7 @@ public static void HttpPostNoRequest(string Url, string postDataStr, bool IsJson
/// <param name="url">请求地址</param>
/// <param name="file">文件路径</param>
/// <returns></returns>
public
static
string
HttpClient
(
string
url
,
string
file
)
public
static
string
HttpClient
(
string
url
,
string
file
,
bool
IsAsync
=
false
)
{
try
{
...
...
@@ -176,10 +176,16 @@ public static string HttpClient(string url, string file)
client
.
Credentials
=
CredentialCache
.
DefaultCredentials
;
client
.
Headers
.
Add
(
"Content-Type"
,
"application/form-data"
);
//注意头部必须是form-data
client
.
QueryString
[
"path"
]
=
file
;
if
(!
IsAsync
)
{
byte
[]
fileb
=
client
.
UploadFile
(
new
Uri
(
url
),
"POST"
,
file
);
string
res
=
Encoding
.
UTF8
.
GetString
(
fileb
);
return
res
;
}
else
client
.
UploadFileAsync
(
new
Uri
(
url
),
"POST"
,
file
);
return
""
;
}
catch
(
Exception
ex
)
{
throw
ex
;
...
...
performance/Performance.Services/DFExtractService.cs
View file @
2ddb327b
...
...
@@ -175,7 +175,7 @@ public string TemplateExecute(string email, per_allot lastAllot, sys_hospital ho
WriteIncome
(
sheet
,
sheetRead
,
unitList
,
configs
,
modules
,
items
,
extracts
);
break
;
case
SheetType
.
Expend
:
WriteExpend
(
sheet
,
sheetRead
,
modules
,
item
s
);
WriteExpend
(
sheet
,
sheetRead
,
unitList
,
configs
,
modules
,
items
,
extract
s
);
break
;
case
SheetType
.
Workload
:
WriteWorkload
(
sheet
,
sheetRead
,
unitList
,
configs
,
modules
,
items
,
extracts
);
...
...
@@ -241,7 +241,7 @@ public string AlllotExecute(string email, per_allot lastAllot, sys_hospital hosp
break
;
case
SheetType
.
Expend
:
ClearData
(
sheet
,
5
);
WriteExpend
(
sheet
,
sheetRead
,
modules
,
item
s
,
false
);
WriteExpend
(
sheet
,
sheetRead
,
unitList
,
configs
,
modules
,
items
,
extract
s
,
false
);
break
;
case
SheetType
.
Workload
:
ClearData
(
sheet
,
3
);
...
...
@@ -424,7 +424,7 @@ private void WriteIncome(ISheet sheet, IPerSheetDataRead sheetRead, List<Account
WriteSheetData
(
sheet
,
sheetRead
,
unitList
,
allExtract
);
}
private
void
WriteExpend
(
ISheet
sheet
,
IPerSheetDataRead
sheetRead
,
List
<
mod_module
>
modules
,
List
<
mod_item
>
item
s
,
bool
IsWriteHead
=
true
)
private
void
WriteExpend
(
ISheet
sheet
,
IPerSheetDataRead
sheetRead
,
List
<
AccountUnitEntity
>
unitList
,
List
<
sys_hospitalconfig
>
configs
,
List
<
mod_module
>
modules
,
List
<
mod_item
>
items
,
List
<
mod_extract
>
extract
s
,
bool
IsWriteHead
=
true
)
{
var
module
=
modules
.
FirstOrDefault
(
t
=>
t
.
SheetType
==
(
int
)
SheetType
.
Expend
);
if
(
module
==
null
)
return
;
...
...
@@ -434,6 +434,31 @@ private void WriteExpend(ISheet sheet, IPerSheetDataRead sheetRead, List<mod_mod
if
(
IsWriteHead
)
WriteHeaderAndFactor
(
sheet
,
sheetRead
,
itemList
);
//查询数据
var
extractIdList
=
itemList
.
Select
(
t
=>
t
.
ExtractId
).
Distinct
().
ToList
();
var
extractList
=
extracts
.
Where
(
t
=>
extractIdList
.
Contains
(
t
.
Id
)).
ToList
();
if
(
extractList
==
null
||
extractList
.
Count
==
0
)
return
;
List
<
ExtractDto
>
allExtract
=
new
List
<
ExtractDto
>();
foreach
(
var
item
in
extractList
)
{
var
category
=
itemList
.
Where
(
t
=>
t
.
ExtractId
==
item
.
Id
);
if
(
category
==
null
||
category
.
Count
()
==
0
)
continue
;
foreach
(
var
moditem
in
category
)
{
logManageService
.
WriteMsg
(
"提取绩效数据"
,
$"执行SQL脚本获取数据 --
{
module
.
ModuleName
}
"
,
1
,
Allot
.
ID
,
"ReceiveMessage"
);
logger
.
LogInformation
(
$"提取绩效数据 执行SQL脚本获取数据 --
{
module
.
ModuleName
}
,"
);
var
config
=
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
moditem
.
ConfigId
);
if
(
config
==
null
)
continue
;
var
result
=
QueryDatabase
(
config
,
item
,
Allot
,
moditem
.
ItemName
);
if
(
result
!=
null
)
allExtract
.
AddRange
(
result
);
}
}
WriteSheetData
(
sheet
,
sheetRead
,
unitList
,
allExtract
);
}
private
void
WriteWorkload
(
ISheet
sheet
,
IPerSheetDataRead
sheetRead
,
List
<
AccountUnitEntity
>
unitList
,
List
<
sys_hospitalconfig
>
configs
,
List
<
mod_module
>
modules
,
List
<
mod_item
>
items
,
List
<
mod_extract
>
extracts
,
bool
IsWriteHead
=
true
)
...
...
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