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
2c0b4dc7
Commit
2c0b4dc7
authored
Apr 03, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效归档,归档前检查数据
parent
741530f5
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
85 additions
and
8 deletions
+85
-8
performance/Performance.Api/Controllers/AgainAllotController.cs
+2
-3
performance/Performance.Api/Controllers/AllotController.cs
+32
-0
performance/Performance.DtoModels/Response/AgainAllotResponse.cs
+1
-1
performance/Performance.EntityModels/Entity/per_againallot.cs
+1
-1
performance/Performance.Services/AgainAllotService.cs
+2
-2
performance/Performance.Services/AllotService.cs
+47
-1
No files found.
performance/Performance.Api/Controllers/AgainAllotController.cs
View file @
2c0b4dc7
...
...
@@ -74,11 +74,10 @@ public ApiResponse Import([FromForm] IFormCollection form)
if
(
file
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"文件无效"
);
var
again
=
againAllotService
.
GetAgainallot
(
againid
);
if
(
again
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"二次绩效记录不存在"
);
var
allot
=
allotService
.
GetAllot
(
again
.
AllotID
.
Value
);
if
(
again
==
null
||
allot
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"二次绩效记录不存在"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
...
...
performance/Performance.Api/Controllers/AllotController.cs
View file @
2c0b4dc7
...
...
@@ -160,5 +160,37 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
BackgroundJob
.
Enqueue
(()
=>
_allotService
.
Generate
(
allot
,
user
));
return
new
ApiResponse
(
ResponseType
.
OK
);
}
/// <summary>
/// 归档绩效记录
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"pigeonhole"
)]
[
HttpPost
]
public
ApiResponse
Pigeonhole
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
AllotRequest
request
)
{
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
)
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
_allotService
.
Pigeonhole
(
allot
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
/// <summary>
/// 检索数据是否合格
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[
Route
(
"checkdata"
)]
[
HttpPost
]
public
ApiResponse
CheckData
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
AllotRequest
request
)
{
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
)
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
var
list
=
_allotService
.
CheckData
(
allot
);
return
new
ApiResponse
(
ResponseType
.
OK
,
list
);
}
}
}
performance/Performance.DtoModels/Response/AgainAllotResponse.cs
View file @
2c0b4dc7
...
...
@@ -42,7 +42,7 @@ public class AgainAllotResponse
public
string
Path
{
get
;
set
;
}
/// <summary>
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
5 归档
/// </summary>
public
Nullable
<
int
>
States
{
get
;
set
;
}
}
...
...
performance/Performance.EntityModels/Entity/per_againallot.cs
View file @
2c0b4dc7
...
...
@@ -52,7 +52,7 @@ public class per_againallot
public
string
Path
{
get
;
set
;
}
/// <summary>
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
/// 二次分配状态 0 数据未上传 1 数据已上传 2 正在生成绩效 3 绩效生成成功 4 绩效生成失败
5 归档
/// </summary>
public
Nullable
<
int
>
States
{
get
;
set
;
}
...
...
performance/Performance.Services/AgainAllotService.cs
View file @
2c0b4dc7
...
...
@@ -392,13 +392,13 @@ public List<AgainAllotResponse> GetAllotList(int userid)
}
/// <summary>
/// 获取二次绩效的记录
/// 获取
状态不是归档的
二次绩效的记录
/// </summary>
/// <param name="againid"></param>
/// <returns></returns>
public
per_againallot
GetAgainallot
(
int
againid
)
{
var
list
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
);
var
list
=
perforPeragainallotRepository
.
GetEntity
(
t
=>
t
.
ID
==
againid
&&
t
.
States
!=
5
);
return
list
;
}
}
...
...
performance/Performance.Services/AllotService.cs
View file @
2c0b4dc7
...
...
@@ -28,6 +28,7 @@ public class AllotService : IAutoInjection
private
ILogger
<
AllotService
>
_logger
;
private
PerforPerallotRepository
_allotRepository
;
private
IEmailService
emailService
;
private
PerforPeragainallotRepository
_againallotRepository
;
public
AllotService
(
PerforPerallotRepository
allotRepository
,
BaiscNormService
baiscNormService
,
...
...
@@ -38,9 +39,11 @@ public class AllotService : IAutoInjection
ConfigService
configService
,
PerforLogdbugRepository
logdbug
,
IHostingEnvironment
evn
,
ILogger
<
AllotService
>
logger
,
IEmailService
emailService
)
IEmailService
emailService
,
PerforPeragainallotRepository
againallotRepository
)
{
_allotRepository
=
allotRepository
;
_againallotRepository
=
againallotRepository
;
_logger
=
logger
;
_evn
=
evn
;
this
.
baiscNormService
=
baiscNormService
;
...
...
@@ -219,6 +222,13 @@ public void Generate(per_allot allot, UserIdentity user)
}
}
/// <summary>
/// 发送邮件
/// </summary>
/// <param name="allot"></param>
/// <param name="mail"></param>
/// <param name="subject"></param>
/// <param name="body"></param>
private
void
SendEmail
(
per_allot
allot
,
string
mail
,
string
subject
,
string
body
)
{
var
message
=
new
EmailMessage
...
...
@@ -230,5 +240,41 @@ private void SendEmail(per_allot allot, string mail, string subject, string body
};
emailService
.
SendAsync
(
message
);
}
/// <summary>
/// 归档绩效记录
/// </summary>
/// <param name="allot"></param>
public
void
Pigeonhole
(
per_allot
allot
)
{
allot
.
States
=
8
;
allot
.
Remark
=
"归档"
;
if
(
_allotRepository
.
Update
(
allot
))
{
var
again
=
_againallotRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
foreach
(
var
item
in
again
)
{
item
.
States
=
5
;
item
.
Remark
=
"归档"
;
_againallotRepository
.
Update
(
item
);
}
}
}
/// <summary>
/// 检索数据是否合格
/// </summary>
/// <param name="allot"></param>
public
List
<
AgainAllotResponse
>
CheckData
(
per_allot
allot
)
{
List
<
int
>
states
=
new
List
<
int
>()
{
0
,
1
,
2
,
4
};
var
again
=
_againallotRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
&&
states
.
Contains
(
t
.
States
.
Value
));
List
<
AgainAllotResponse
>
result
=
Mapper
.
Map
<
List
<
AgainAllotResponse
>>(
again
);
if
(
result
!=
null
&&
result
.
Count
>
0
)
{
result
.
ForEach
(
t
=>
{
t
.
Year
=
allot
.
Year
;
t
.
Month
=
allot
.
Month
;
});
}
return
result
;
}
}
}
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