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
6f0778d7
Commit
6f0778d7
authored
Sep 29, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
保底绩效修改
parent
efefd1c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
34 deletions
+39
-34
performance/Performance.Services/GuaranteeService.cs
+39
-34
No files found.
performance/Performance.Services/GuaranteeService.cs
View file @
6f0778d7
...
@@ -99,43 +99,18 @@ public List<cof_guarantee> GuarantInsert(GuaranteeRequest request)
...
@@ -99,43 +99,18 @@ public List<cof_guarantee> GuarantInsert(GuaranteeRequest request)
public
List
<
cof_guarantee
>
GuarantUpdate
(
GuaranteeRequest
request
)
public
List
<
cof_guarantee
>
GuarantUpdate
(
GuaranteeRequest
request
)
{
{
var
guarantee
=
perforCofguaranteeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Source
.
FirstOrDefault
().
GId
);
var
guarantee
=
perforCofguaranteeRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
Source
.
FirstOrDefault
().
GId
);
var
guaranteeList
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
UnitType
==
guarantee
.
UnitType
&&
t
.
Target
==
guarantee
.
Target
);
var
guaranteeList
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
guarantee
.
AllotId
&&
t
.
UnitType
==
guarantee
.
UnitType
&&
t
.
Target
==
guarantee
.
Target
);
if
(
guaranteeList
==
null
)
if
(
guaranteeList
==
null
)
throw
new
PerformanceException
(
"提交数据无效"
);
throw
new
PerformanceException
(
"提交数据无效"
);
#
region
修改优先级
int
flag
=
guaranteeList
.
FirstOrDefault
().
Priority
.
Value
;
if
(
flag
>
request
.
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
())
{
list
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
else
if
(
flag
<
request
.
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
())
{
list
.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
-
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
else
if
(
flag
==
request
.
Priority
)
{
var
list
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
request
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Priority
==
request
.
Priority
);
if
(
list
!=
null
&&
list
.
Any
())
{
list
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
#
endregion
#
region
添加
#
region
添加
var
insertList
=
request
.
Source
.
Where
(
t
=>
t
.
GId
.
HasValue
&&
t
.
GId
==
0
).
Select
(
t
=>
new
cof_guarantee
{
Source
=
t
.
GValue
}).
ToList
();
//a合并到b集合 过滤b集合中已存在的Source
var
filterList
=
perforCofguaranteeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
guarantee
.
AllotId
&&
t
.
UnitType
==
request
.
UnitType
&&
t
.
Target
==
request
.
Target
);
if
(
request
.
UnitType
!=
guarantee
.
UnitType
&&
filterList
!=
null
&&
filterList
.
Count
>
0
)
throw
new
PerformanceException
(
$"
{((
UnitType
)
request
.
UnitType
).
ToString
()}
已存在
{
request
.
Target
}
,请重新选择"
);
var
insertList
=
request
.
Source
.
Where
(
t
=>
t
.
GId
.
HasValue
&&
t
.
GId
==
0
&&
!
filterList
.
Select
(
g
=>
g
.
Source
).
Contains
(
t
.
GValue
)).
Select
(
t
=>
new
cof_guarantee
{
Source
=
t
.
GValue
}).
ToList
();
insertList
.
ForEach
(
t
=>
insertList
.
ForEach
(
t
=>
{
{
t
.
AllotId
=
request
.
AllotId
;
t
.
AllotId
=
request
.
AllotId
;
...
@@ -155,7 +130,7 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
...
@@ -155,7 +130,7 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
t
.
Source
=
request
.
Source
.
FirstOrDefault
(
s
=>
s
.
GId
==
t
.
Id
).
GValue
;
t
.
Source
=
request
.
Source
.
FirstOrDefault
(
s
=>
s
.
GId
==
t
.
Id
).
GValue
;
else
else
delItem
.
Add
(
t
.
Id
);
delItem
.
Add
(
t
.
Id
);
t
.
Priority
=
request
.
Priority
;
//
t.Priority = request.Priority;
t
.
UnitType
=
request
.
UnitType
;
t
.
UnitType
=
request
.
UnitType
;
t
.
Target
=
request
.
Target
;
t
.
Target
=
request
.
Target
;
});
});
...
@@ -167,6 +142,36 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
...
@@ -167,6 +142,36 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
perforCofguaranteeRepository
.
RemoveRange
(
guaranteeList
.
Where
(
t
=>
delItem
.
Contains
(
t
.
Id
)).
ToArray
());
perforCofguaranteeRepository
.
RemoveRange
(
guaranteeList
.
Where
(
t
=>
delItem
.
Contains
(
t
.
Id
)).
ToArray
());
#
endregion
#
endregion
#
region
修改优先级
int
flag
=
guaranteeList
.
FirstOrDefault
().
Priority
.
Value
;
if
(
flag
>
request
.
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
())
{
list
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
else
if
(
flag
<
request
.
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
())
{
list
.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
-
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
list
.
ToArray
());
}
}
else
if
(
flag
==
request
.
Priority
)
{
if
(
filterList
!=
null
&&
filterList
.
Any
())
{
filterList
?.
ForEach
(
t
=>
{
t
.
Priority
=
t
.
Priority
+
1
;
});
perforCofguaranteeRepository
.
UpdateRange
(
filterList
.
ToArray
());
}
}
#
endregion
guaranteeList
.
AddRange
(
insertList
);
guaranteeList
.
AddRange
(
insertList
);
return
guaranteeList
.
Where
(
t
=>
!
delItem
.
Contains
(
t
.
Id
))?.
ToList
();
return
guaranteeList
.
Where
(
t
=>
!
delItem
.
Contains
(
t
.
Id
))?.
ToList
();
}
}
...
...
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