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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
137 additions
and
47 deletions
+137
-47
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
+19
-9
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
/// <returns></returns>
[
Route
(
"allotlist"
)]
[
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
);
}
...
...
@@ -65,21 +66,19 @@ public ApiResponse AllotList([FromBody]UserRequest request)
[
HttpPost
]
public
ApiResponse
Import
([
FromForm
]
IFormCollection
form
)
{
var
allotid
=
form
.
ToDictionary
().
GetValue
(
"allotid"
,
0
);
if
(
allotid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"allotid无效"
);
var
userid
=
form
.
ToDictionary
().
GetValue
(
"userid"
,
0
);
if
(
userid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"userid无效"
);
var
againid
=
form
.
ToDictionary
().
GetValue
(
"againid"
,
0
);
if
(
againid
<=
0
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"againid无效"
);
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
if
(
file
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"文件无效"
);
var
allot
=
allotService
.
GetAllot
(
allotid
);
if
(
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"allotid不存在"
);
var
again
=
againAllotService
.
GetAgainallot
(
againid
);
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
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
...
...
@@ -96,11 +95,11 @@ public ApiResponse Import([FromForm] IFormCollection form)
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传失败"
);
allot
.
Path
=
path
;
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
}
上传成功,修改状态失败"
);
configService
.
ClearAgain
(
flag
);
configService
.
CopyAgain
(
flag
);
configService
.
ClearAgain
(
againid
);
configService
.
CopyAgain
(
againid
);
}
return
new
ApiResponse
(
ResponseType
.
OK
);
...
...
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
d54d5350
...
...
@@ -109,6 +109,8 @@ public AutoMapperConfigs()
CreateMap
<
res_accountdoctor
,
DoctorResponse
>();
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
...
...
@@ -7,45 +7,55 @@
using
System.ComponentModel.DataAnnotations
;
using
System.ComponentModel.DataAnnotations.Schema
;
namespace
Performance.EntityModels
namespace
Performance.EntityModels
{
/// <summary>
///
/// </summary>
[
Table
(
"per_againallot"
)]
public
class
per_againallot
public
class
per_againallot
{
/// <summary>
///
/// </summary>
[
Key
]
public
int
ID
{
get
;
set
;
}
public
int
ID
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
int
>
AllotID
{
get
;
set
;
}
/// <summary>
/// 用户ID
/// </summary>
public
Nullable
<
int
>
CreateUser
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
Nullable
<
DateTime
>
CreateDateTime
{
get
;
set
;
}
/// <summary>
/// 上传时间
/// </summary>
public
Nullable
<
DateTime
>
UploadDateTime
{
get
;
set
;
}
/// <summary>
/// 科室名称
/// </summary>
public
string
Department
{
get
;
set
;
}
/// <summary>
/// 文件路径
/// </summary>
public
string
Path
{
get
;
set
;
}
/// <summary>
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
/// </summary>
public
Nullable
<
int
>
States
{
get
;
set
;
}
/// <summary>
/// 备注
/// </summary>
...
...
performance/Performance.Services/AgainAllotService.cs
View file @
d54d5350
...
...
@@ -235,28 +235,22 @@ public class AgainAllotService : IAutoInjection
/// <param name="allot"></param>
/// <param name="userid"></param>
/// <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
model
=
new
per_againallot
{
AllotID
=
allot
.
ID
,
CreateUser
=
userid
,
CreateDateTime
=
DateTime
.
Now
,
Department
=
user
.
Department
,
Path
=
allot
.
Path
,
Remark
=
allot
.
Remark
};
if
(!
perforPeragainallotRepository
.
Add
(
model
))
return
0
;
return
model
.
ID
;
var
again
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
);
again
.
ID
=
againid
;
again
.
UploadDateTime
=
DateTime
.
Now
;
again
.
Path
=
allot
.
Path
;
again
.
Remark
=
allot
.
Remark
;
again
.
States
=
1
;
return
perforPeragainallotRepository
.
Update
(
again
);
}
/// <summary>
/// 根据人物角色获取绩效列表
/// </summary>
/// <returns></returns>
public
List
<
AllotResponse
>
GetAllotList
(
int
userid
)
public
List
<
A
gainA
llotResponse
>
GetAllotList
(
int
userid
)
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userid
);
if
(
user
==
null
)
...
...
@@ -264,13 +258,49 @@ public List<AllotResponse> GetAllotList(int userid)
var
hospital
=
perforUserhospitalRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userid
);
if
(
hospital
==
null
)
throw
new
NotImplementedException
(
"人员未选择医院"
);
var
allot
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
);
List
<
AllotResponse
>
list
=
Mapper
.
Map
<
List
<
AllotResponse
>>(
allot
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
var
allot
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
&&
t
.
CreateUser
==
userid
);
if
(
allot
==
null
)
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
)
{
list
=
list
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenByDescending
(
t
=>
t
.
Month
).
ToList
();
list
.
ForEach
(
t
=>
t
.
Department
=
user
.
Department
);
allot
=
allot
.
Where
(
t
=>
exceptId
.
Contains
(
t
.
ID
)).
ToList
();
var
model
=
allot
.
Select
(
t
=>
new
per_againallot
{
AllotID
=
t
.
ID
,
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
;
}
}
...
...
performance/Performance.Services/ConfigService.cs
View file @
d54d5350
...
...
@@ -430,14 +430,14 @@ public void CopyAgain(int againid)
if
(
again
.
AllotID
!=
allot
.
ID
&&
beforeAgain
!=
null
)
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
{
AllotID
=
allot
.
ID
,
AgainAllotID
=
againid
,
Type
=
t
.
Type
,
TypeName
=
t
.
TypeName
,
Value
=
(
t
.
Type
==
3
&&
beforeAgain
!=
null
)
?
days
:
t
.
Value
Value
=
t
.
Value
});
_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