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
d54d5350
Commit
d54d5350
authored
Apr 03, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传文件、获取二次绩效记录调整
parent
debc4131
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
38 deletions
+128
-38
performance/Performance.Api/Controllers/AgainAllotController.cs
+15
-16
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
+2
-0
performance/Performance.DtoModels/Response/AgainAllotResponse.cs
+49
-0
performance/Performance.EntityModels/Entity/per_againallot.cs
+10
-0
performance/Performance.Services/AgainAllotService.cs
+50
-20
performance/Performance.Services/ConfigService.cs
+2
-2
No files found.
performance/Performance.Api/Controllers/AgainAllotController.cs
View file @
d54d5350
...
@@ -50,9 +50,10 @@ public class AgainAllotController : Controller
...
@@ -50,9 +50,10 @@ public class AgainAllotController : Controller
/// <returns></returns>
/// <returns></returns>
[
Route
(
"allotlist"
)]
[
Route
(
"allotlist"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
AllotList
([
FromBody
]
User
Request
request
)
public
ApiResponse
AllotList
([
FromBody
]
Api
Request
request
)
{
{
var
list
=
againAllotService
.
GetAllotList
(
request
.
ID
);
var
user
=
claimService
.
At
(
request
);
var
list
=
againAllotService
.
GetAllotList
(
user
.
UserID
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
}
...
@@ -65,21 +66,19 @@ public ApiResponse AllotList([FromBody]UserRequest request)
...
@@ -65,21 +66,19 @@ public ApiResponse AllotList([FromBody]UserRequest request)
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
Import
([
FromForm
]
IFormCollection
form
)
public
ApiResponse
Import
([
FromForm
]
IFormCollection
form
)
{
{
var
allotid
=
form
.
ToDictionary
().
GetValue
(
"allotid"
,
0
);
var
againid
=
form
.
ToDictionary
().
GetValue
(
"againid"
,
0
);
if
(
allotid
<=
0
)
if
(
againid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"againid无效"
);
var
userid
=
form
.
ToDictionary
().
GetValue
(
"userid"
,
0
);
if
(
userid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"userid无效"
);
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
if
(
file
==
null
)
if
(
file
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"文件无效"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"文件无效"
);
var
allot
=
allotService
.
GetAllot
(
allotid
);
if
(
allot
==
null
)
var
again
=
againAllotService
.
GetAgainallot
(
againid
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"allotid不存在"
);
if
(
again
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"二次绩效记录不存在"
);
var
allot
=
allotService
.
GetAllot
(
again
.
AllotID
.
Value
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
...
@@ -96,11 +95,11 @@ public ApiResponse Import([FromForm] IFormCollection form)
...
@@ -96,11 +95,11 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传失败"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传失败"
);
allot
.
Path
=
path
;
allot
.
Path
=
path
;
allot
.
Remark
=
EnumHelper
.
GetDescription
(
AllotStates
.
FileUploaded
);
allot
.
Remark
=
EnumHelper
.
GetDescription
(
AllotStates
.
FileUploaded
);
int
flag
=
againAllotService
.
Insert
(
allot
,
userid
);
if
(
flag
==
0
)
if
(
!
againAllotService
.
Update
(
allot
,
againid
)
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传成功,修改状态失败"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传成功,修改状态失败"
);
configService
.
ClearAgain
(
flag
);
configService
.
ClearAgain
(
againid
);
configService
.
CopyAgain
(
flag
);
configService
.
CopyAgain
(
againid
);
}
}
return
new
ApiResponse
(
ResponseType
.
OK
);
return
new
ApiResponse
(
ResponseType
.
OK
);
...
...
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
d54d5350
...
@@ -109,6 +109,8 @@ public AutoMapperConfigs()
...
@@ -109,6 +109,8 @@ public AutoMapperConfigs()
CreateMap
<
res_accountdoctor
,
DoctorResponse
>();
CreateMap
<
res_accountdoctor
,
DoctorResponse
>();
CreateMap
<
res_accountnurse
,
NurseResponse
>();
CreateMap
<
res_accountnurse
,
NurseResponse
>();
CreateMap
<
per_againallot
,
AgainAllotResponse
>();
}
}
}
}
}
}
performance/Performance.DtoModels/Response/AgainAllotResponse.cs
0 → 100644
View file @
d54d5350
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
AgainAllotResponse
{
/// <summary>
///
/// </summary>
public
int
ID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
AllotID
{
get
;
set
;
}
/// <summary>
/// 绩效发放年
/// </summary>
public
int
Year
{
get
;
set
;
}
/// <summary>
/// 绩效发放月
/// </summary>
public
int
Month
{
get
;
set
;
}
/// <summary>
/// 科室名称
/// </summary>
public
string
Department
{
get
;
set
;
}
/// <summary>
/// 上传时间
/// </summary>
public
Nullable
<
DateTime
>
UploadDateTime
{
get
;
set
;
}
/// <summary>
/// 文件路径
/// </summary>
public
string
Path
{
get
;
set
;
}
/// <summary>
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
/// </summary>
public
Nullable
<
int
>
States
{
get
;
set
;
}
}
}
performance/Performance.EntityModels/Entity/per_againallot.cs
View file @
d54d5350
...
@@ -37,6 +37,11 @@ public class per_againallot
...
@@ -37,6 +37,11 @@ public class per_againallot
public
Nullable
<
DateTime
>
CreateDateTime
{
get
;
set
;
}
public
Nullable
<
DateTime
>
CreateDateTime
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 上传时间
/// </summary>
public
Nullable
<
DateTime
>
UploadDateTime
{
get
;
set
;
}
/// <summary>
/// 科室名称
/// 科室名称
/// </summary>
/// </summary>
public
string
Department
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
...
@@ -47,6 +52,11 @@ public class per_againallot
...
@@ -47,6 +52,11 @@ public class per_againallot
public
string
Path
{
get
;
set
;
}
public
string
Path
{
get
;
set
;
}
/// <summary>
/// <summary>
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
/// </summary>
public
Nullable
<
int
>
States
{
get
;
set
;
}
/// <summary>
/// 备注
/// 备注
/// </summary>
/// </summary>
public
string
Remark
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
...
...
performance/Performance.Services/AgainAllotService.cs
View file @
d54d5350
...
@@ -235,28 +235,22 @@ public class AgainAllotService : IAutoInjection
...
@@ -235,28 +235,22 @@ public class AgainAllotService : IAutoInjection
/// <param name="allot"></param>
/// <param name="allot"></param>
/// <param name="userid"></param>
/// <param name="userid"></param>
/// <returns></returns>
/// <returns></returns>
public
int
Insert
(
per_allot
allot
,
int
user
id
)
public
bool
Update
(
per_allot
allot
,
int
again
id
)
{
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
var
again
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
);
var
model
=
new
per_againallot
again
.
ID
=
againid
;
{
again
.
UploadDateTime
=
DateTime
.
Now
;
AllotID
=
allot
.
ID
,
again
.
Path
=
allot
.
Path
;
CreateUser
=
userid
,
again
.
Remark
=
allot
.
Remark
;
CreateDateTime
=
DateTime
.
Now
,
again
.
States
=
1
;
Department
=
user
.
Department
,
return
perforPeragainallotRepository
.
Update
(
again
);
Path
=
allot
.
Path
,
Remark
=
allot
.
Remark
};
if
(!
perforPeragainallotRepository
.
Add
(
model
))
return
0
;
return
model
.
ID
;
}
}
/// <summary>
/// <summary>
/// 根据人物角色获取绩效列表
/// 根据人物角色获取绩效列表
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
public
List
<
AllotResponse
>
GetAllotList
(
int
userid
)
public
List
<
A
gainA
llotResponse
>
GetAllotList
(
int
userid
)
{
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
if
(
user
==
null
)
if
(
user
==
null
)
...
@@ -264,13 +258,49 @@ public List<AllotResponse> GetAllotList(int userid)
...
@@ -264,13 +258,49 @@ public List<AllotResponse> GetAllotList(int userid)
var
hospital
=
perforUserhospitalRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userid
);
var
hospital
=
perforUserhospitalRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userid
);
if
(
hospital
==
null
)
if
(
hospital
==
null
)
throw
new
NotImplementedException
(
"人员未选择医院"
);
throw
new
NotImplementedException
(
"人员未选择医院"
);
var
allot
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
);
var
allot
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
&&
t
.
CreateUser
==
userid
);
List
<
AllotResponse
>
list
=
Mapper
.
Map
<
List
<
AllotResponse
>>(
allot
);
if
(
allot
==
null
)
if
(
list
!=
null
&&
list
.
Count
>
0
)
throw
new
NotImplementedException
(
"该医院未生成绩效"
);
var
allotId
=
allot
.
Select
(
t
=>
t
.
ID
).
ToList
();
var
again
=
perforPeragainallotRepository
.
GetEntities
(
t
=>
allotId
.
Contains
(
t
.
AllotID
.
Value
)
&&
t
.
CreateUser
==
userid
);
var
arrId
=
again
==
null
?
new
List
<
int
>()
:
again
.
Select
(
t
=>
t
.
AllotID
.
Value
).
ToList
();
//取得未生成二次绩效的绩效id
var
exceptId
=
allotId
.
Except
(
arrId
).
ToList
();
if
(
exceptId
.
Count
>
0
)
{
allot
=
allot
.
Where
(
t
=>
exceptId
.
Contains
(
t
.
ID
)).
ToList
();
var
model
=
allot
.
Select
(
t
=>
new
per_againallot
{
{
list
=
list
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
AllotID
=
t
.
ID
,
list
.
ForEach
(
t
=>
t
.
Department
=
user
.
Department
);
CreateUser
=
userid
,
CreateDateTime
=
DateTime
.
Now
,
Department
=
user
.
Department
,
States
=
0
});
//生成二次绩效
perforPeragainallotRepository
.
AddRange
(
model
.
ToArray
());
}
again
=
perforPeragainallotRepository
.
GetEntities
(
t
=>
allotId
.
Contains
(
t
.
AllotID
.
Value
)
&&
t
.
CreateUser
==
userid
);
List
<
AgainAllotResponse
>
list
=
Mapper
.
Map
<
List
<
AgainAllotResponse
>>(
again
);
list
.
ForEach
(
t
=>
{
var
data
=
allot
.
Where
(
p
=>
p
.
ID
==
t
.
AllotID
).
FirstOrDefault
();
t
.
Year
=
data
.
Year
;
t
.
Month
=
data
.
Month
;
});
return
list
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
}
}
/// <summary>
/// 获取二次绩效的记录
/// </summary>
/// <param name="againid"></param>
/// <returns></returns>
public
per_againallot
GetAgainallot
(
int
againid
)
{
var
list
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
);
return
list
;
return
list
;
}
}
}
}
...
...
performance/Performance.Services/ConfigService.cs
View file @
d54d5350
...
@@ -430,14 +430,14 @@ public void CopyAgain(int againid)
...
@@ -430,14 +430,14 @@ public void CopyAgain(int againid)
if
(
again
.
AllotID
!=
allot
.
ID
&&
beforeAgain
!=
null
)
if
(
again
.
AllotID
!=
allot
.
ID
&&
beforeAgain
!=
null
)
record
=
_againRepository
.
GetEntities
(
t
=>
t
.
AgainAllotID
==
beforeAgain
.
ID
);
record
=
_againRepository
.
GetEntities
(
t
=>
t
.
AgainAllotID
==
beforeAgain
.
ID
);
int
days
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
//
int days = DateTime.DaysInMonth(allot.Year, allot.Month);
var
againList
=
record
.
Select
(
t
=>
new
cof_again
var
againList
=
record
.
Select
(
t
=>
new
cof_again
{
{
AllotID
=
allot
.
ID
,
AllotID
=
allot
.
ID
,
AgainAllotID
=
againid
,
AgainAllotID
=
againid
,
Type
=
t
.
Type
,
Type
=
t
.
Type
,
TypeName
=
t
.
TypeName
,
TypeName
=
t
.
TypeName
,
Value
=
(
t
.
Type
==
3
&&
beforeAgain
!=
null
)
?
days
:
t
.
Value
Value
=
t
.
Value
});
});
_againRepository
.
AddRange
(
againList
.
ToArray
());
_againRepository
.
AddRange
(
againList
.
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