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
f0a35d36
Commit
f0a35d36
authored
Sep 26, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保底绩效接口修改
parent
c0e36e2c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
26 deletions
+69
-26
performance/Performance.Api/Controllers/GuaranteeController.cs
+11
-7
performance/Performance.DtoModels/Request/GuaranteeRequest.cs
+1
-1
performance/Performance.DtoModels/Response/GuaranteeResponse.cs
+1
-1
performance/Performance.Services/GuaranteeService.cs
+56
-17
No files found.
performance/Performance.Api/Controllers/GuaranteeController.cs
View file @
f0a35d36
...
@@ -41,12 +41,13 @@ public ApiResponse<List<GuaranteeResponse>> Guarantee([CustomizeValidator(RuleSe
...
@@ -41,12 +41,13 @@ public ApiResponse<List<GuaranteeResponse>> Guarantee([CustomizeValidator(RuleSe
/// <returns></returns>
/// <returns></returns>
[
Route
(
"insert"
)]
[
Route
(
"insert"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
<
cof_guarantee
>
GuarantInsert
([
CustomizeValidator
(
RuleSet
=
"Insert"
),
FromBody
]
GuaranteeRequest
request
)
public
ApiResponse
<
List
<
cof_guarantee
>
>
GuarantInsert
([
CustomizeValidator
(
RuleSet
=
"Insert"
),
FromBody
]
GuaranteeRequest
request
)
{
{
var
entity
=
guaranteeService
.
GuarantInsert
(
request
);
if
(
request
.
Source
==
null
||
request
.
Source
.
Count
==
0
)
if
(
entity
.
Id
>
0
)
return
new
ApiResponse
<
List
<
cof_guarantee
>>(
ResponseType
.
ParameterError
,
"保底来源科室 无效"
);
return
new
ApiResponse
<
cof_guarantee
>(
ResponseType
.
OK
,
"新增配置成功"
,
entity
);
return
new
ApiResponse
<
cof_guarantee
>(
ResponseType
.
Fail
,
"新增配置失败"
,
entity
);
var
list
=
guaranteeService
.
GuarantInsert
(
request
);
return
new
ApiResponse
<
List
<
cof_guarantee
>>(
ResponseType
.
OK
,
"新增配置成功"
,
list
);
}
}
/// <summary>
/// <summary>
...
@@ -56,10 +57,13 @@ public ApiResponse<cof_guarantee> GuarantInsert([CustomizeValidator(RuleSet = "I
...
@@ -56,10 +57,13 @@ public ApiResponse<cof_guarantee> GuarantInsert([CustomizeValidator(RuleSet = "I
/// <returns></returns>
/// <returns></returns>
[
Route
(
"update"
)]
[
Route
(
"update"
)]
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
<
cof_guarantee
>
GuarantUpdate
([
CustomizeValidator
(
RuleSet
=
"Update"
),
FromBody
]
GuaranteeRequest
request
)
public
ApiResponse
<
List
<
cof_guarantee
>
>
GuarantUpdate
([
CustomizeValidator
(
RuleSet
=
"Update"
),
FromBody
]
GuaranteeRequest
request
)
{
{
if
(
request
.
Source
==
null
||
request
.
Source
.
Count
==
0
)
return
new
ApiResponse
<
List
<
cof_guarantee
>>(
ResponseType
.
ParameterError
,
"保底来源科室 无效"
);
var
result
=
guaranteeService
.
GuarantUpdate
(
request
);
var
result
=
guaranteeService
.
GuarantUpdate
(
request
);
return
new
ApiResponse
<
cof_guarantee
>(
ResponseType
.
OK
,
"修改配置成功"
,
result
);
return
new
ApiResponse
<
List
<
cof_guarantee
>
>(
ResponseType
.
OK
,
"修改配置成功"
,
result
);
}
}
/// <summary>
/// <summary>
...
...
performance/Performance.DtoModels/Request/GuaranteeRequest.cs
View file @
f0a35d36
...
@@ -23,7 +23,7 @@ public class GuaranteeRequest
...
@@ -23,7 +23,7 @@ public class GuaranteeRequest
public
string
Target
{
get
;
set
;
}
public
string
Target
{
get
;
set
;
}
/// <summary> 保底来源科室 </summary>
/// <summary> 保底来源科室 </summary>
public
string
Source
{
get
;
set
;
}
public
List
<
GuaranItems
>
Source
{
get
;
set
;
}
}
}
...
...
performance/Performance.DtoModels/Response/GuaranteeResponse.cs
View file @
f0a35d36
...
@@ -34,7 +34,7 @@ public class GuaranteeResponse
...
@@ -34,7 +34,7 @@ public class GuaranteeResponse
public
class
GuaranItems
public
class
GuaranItems
{
{
public
int
GId
{
get
;
set
;
}
public
Nullable
<
int
>
GId
{
get
;
set
;
}
public
string
GValue
{
get
;
set
;
}
public
string
GValue
{
get
;
set
;
}
}
}
...
...
performance/Performance.Services/GuaranteeService.cs
View file @
f0a35d36
...
@@ -68,7 +68,7 @@ public List<GuaranteeResponse> GuaranTree(int allotId)
...
@@ -68,7 +68,7 @@ public List<GuaranteeResponse> GuaranTree(int allotId)
/// </summary>
/// </summary>
/// <param name="request"></param>
/// <param name="request"></param>
/// <returns></returns>
/// <returns></returns>
public
cof_guarantee
GuarantInsert
(
GuaranteeRequest
request
)
public
List
<
cof_guarantee
>
GuarantInsert
(
GuaranteeRequest
request
)
{
{
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
request
.
AllotId
);
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
request
.
AllotId
);
if
(
list
!=
null
)
if
(
list
!=
null
)
...
@@ -77,10 +77,18 @@ public cof_guarantee GuarantInsert(GuaranteeRequest request)
...
@@ -77,10 +77,18 @@ public cof_guarantee GuarantInsert(GuaranteeRequest request)
if
(
config
!=
null
)
if
(
config
!=
null
)
throw
new
PerformanceException
(
"优先级无效,已存在"
);
throw
new
PerformanceException
(
"优先级无效,已存在"
);
}
}
var
guaranteeList
=
new
List
<
cof_guarantee
>();
guaranteeList
.
AddRange
(
request
.
Source
.
Select
(
t
=>
new
cof_guarantee
{
Source
=
t
.
GValue
}));
guaranteeList
.
ForEach
(
t
=>
{
t
.
AllotId
=
request
.
AllotId
;
t
.
Priority
=
request
.
Priority
;
t
.
UnitType
=
request
.
UnitType
;
t
.
Target
=
request
.
Target
;
});
var
guarantee
=
Mapper
.
Map
<
cof_guarantee
>(
request
);
perforCofguaranteeRepository
.
AddRange
(
guaranteeList
.
ToArray
());
perforCofguaranteeRepository
.
Add
(
guarantee
);
return
guaranteeList
;
return
guarantee
;
}
}
/// <summary>
/// <summary>
...
@@ -88,38 +96,69 @@ public cof_guarantee GuarantInsert(GuaranteeRequest request)
...
@@ -88,38 +96,69 @@ public cof_guarantee GuarantInsert(GuaranteeRequest request)
/// </summary>
/// </summary>
/// <param name="request"></param>
/// <param name="request"></param>
/// <returns></returns>
/// <returns></returns>
public
cof_guarantee
GuarantUpdate
(
GuaranteeRequest
request
)
public
List
<
cof_guarantee
>
GuarantUpdate
(
GuaranteeRequest
request
)
{
{
var
guarantee
=
perforCofguaranteeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Id
);
var
guarantee
List
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
UnitType
==
request
.
UnitType
&&
t
.
Target
==
request
.
Target
);
if
(
guarantee
==
null
)
if
(
guarantee
List
==
null
)
throw
new
PerformanceException
(
"request.Id 参数错误"
);
throw
new
PerformanceException
(
"request.Id 参数错误"
);
if
(
guarantee
.
Priority
>
request
.
Priority
)
#
region
修改优先级
int
flag
=
guaranteeList
.
FirstOrDefault
().
Priority
.
Value
;
if
(
flag
>
request
.
Priority
)
{
{
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
guarantee
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Priority
>=
request
.
Priority
&&
t
.
Priority
<
guarantee
.
Priority
);
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
request
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Priority
>=
request
.
Priority
&&
t
.
Priority
<
flag
);
if
(
list
!=
null
&&
list
.
Any
())
if
(
list
!=
null
&&
list
.
Any
())
{
{
list
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
list
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
}
}
else
if
(
guarantee
.
Priority
<
request
.
Priority
)
else
if
(
flag
<
request
.
Priority
)
{
{
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
guarantee
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Priority
<=
request
.
Priority
&&
t
.
Priority
>
guarantee
.
Priority
);
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
request
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Priority
<=
request
.
Priority
&&
t
.
Priority
>
flag
);
if
(
list
!=
null
&&
list
.
Any
())
if
(
list
!=
null
&&
list
.
Any
())
{
{
list
.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
-
1
;
});
list
.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
-
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
}
}
#
endregion
#
region
添加
var
insertList
=
request
.
Source
.
Where
(
t
=>
t
.
GId
.
HasValue
&&
t
.
GId
==
0
).
Select
(
t
=>
new
cof_guarantee
{
Source
=
t
.
GValue
}).
ToList
();
insertList
.
ForEach
(
t
=>
{
t
.
AllotId
=
request
.
AllotId
;
t
.
Priority
=
request
.
Priority
;
t
.
UnitType
=
request
.
UnitType
;
t
.
Target
=
request
.
Target
;
});
perforCofguaranteeRepository
.
AddRange
(
insertList
.
ToArray
());
#
endregion
guarantee
.
Priority
=
request
.
Priority
;
#
region
修改、删除
guarantee
.
UnitType
=
request
.
UnitType
;
var
delItem
=
new
List
<
int
>();
guarantee
.
Target
=
request
.
Target
;
var
exist
=
request
.
Source
.
Where
(
t
=>
t
.
GId
.
HasValue
&&
t
.
GId
!=
0
).
Select
(
t
=>
t
.
GId
);
guarantee
.
Source
=
request
.
Source
;
guaranteeList
.
ForEach
(
t
=>
if
(!
perforCofguaranteeRepository
.
Update
(
guarantee
))
{
if
(
exist
.
Contains
(
t
.
Id
))
t
.
Source
=
request
.
Source
.
FirstOrDefault
(
s
=>
s
.
GId
==
t
.
Id
).
GValue
;
else
delItem
.
Add
(
t
.
Id
);
t
.
Priority
=
request
.
Priority
;
t
.
UnitType
=
request
.
UnitType
;
t
.
Target
=
request
.
Target
;
});
if
(!
perforCofguaranteeRepository
.
UpdateRange
(
guaranteeList
.
ToArray
()))
throw
new
PerformanceException
(
"保存失败"
);
throw
new
PerformanceException
(
"保存失败"
);
return
Mapper
.
Map
<
cof_guarantee
>(
request
);
if
(
exist
!=
null
&&
exist
.
Count
()
>
0
)
perforCofguaranteeRepository
.
RemoveRange
(
guaranteeList
.
Where
(
t
=>
delItem
.
Contains
(
t
.
Id
)).
ToArray
());
#
endregion
guaranteeList
.
AddRange
(
insertList
);
return
guaranteeList
.
Where
(
t
=>
!
delItem
.
Contains
(
t
.
Id
))?.
ToList
();
}
}
/// <summary>
/// <summary>
...
...
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