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
588aaec0
Commit
588aaec0
authored
Sep 26, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
数据录入设置权限
parent
4126b0e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
26 deletions
+39
-26
performance/Performance.Services/CollectService.cs
+39
-26
No files found.
performance/Performance.Services/CollectService.cs
View file @
588aaec0
...
@@ -176,32 +176,41 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
...
@@ -176,32 +176,41 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
var
user
=
userRepository
.
GetEntity
(
w
=>
w
.
ID
==
userid
);
var
user
=
userRepository
.
GetEntity
(
w
=>
w
.
ID
==
userid
);
if
(
user
==
null
)
if
(
user
==
null
)
throw
new
PerformanceException
(
"参数无效"
);
throw
new
PerformanceException
(
"参数无效"
);
// 删除
var
data3
=
collects
.
Where
(
w
=>
w
.
PermissionId
.
HasValue
&&
0
==
w
.
Visible
&&
0
==
w
.
AttachLast
&&
0
==
w
.
Readnoly
);
if
(
data3
!=
null
)
{
var
ids
=
data3
.
Select
(
t
=>
t
.
PermissionId
).
ToList
();
var
deletes
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
ids
.
Contains
(
w
.
Id
));
if
(
deletes
!=
null
)
perforcollectpermissionRepository
.
RemoveRange
(
deletes
.
ToArray
());
}
// 修改
//// 删除
var
data1
=
collects
.
Where
(
w
=>
w
.
PermissionId
.
HasValue
&&
(
w
.
Visible
>
0
||
w
.
AttachLast
>
0
||
w
.
Readnoly
>
0
));
//var data3 = collects.Where(w => w.PermissionId.HasValue && 0 == w.Visible && 0 == w.AttachLast && 0 == w.Readnoly);
if
(
data1
!=
null
)
//if (data3 != null)
//{
// var ids = data3.Select(t => t.PermissionId).ToList();
// var deletes = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id));
// if (deletes != null)
// perforcollectpermissionRepository.RemoveRange(deletes.ToArray());
//}
//// 修改
//var data1 = collects.Where(w => w.PermissionId.HasValue && (w.Visible > 0 || w.AttachLast > 0 || w.Readnoly > 0));
//if (data1 != null)
//{
// var ids = data1.Select(t => t.PermissionId).ToList();
// var updates = perforcollectpermissionRepository.GetEntities(w => ids.Contains(w.Id));
// if (updates != null)
// {
// foreach (var item in updates)
// {
// item.AttachLast = data1.FirstOrDefault(w => w.PermissionId == item.Id).AttachLast;
// item.Readnoly = data1.FirstOrDefault(w => w.PermissionId == item.Id).Readnoly;
// item.Visible = data1.FirstOrDefault(w => w.PermissionId == item.Id).Visible;
// }
// perforcollectpermissionRepository.UpdateRange(updates.ToArray());
// }
//}
var
hospitalid
=
collects
?.
FirstOrDefault
(
w
=>
w
.
HospitalId
>
0
)?.
HospitalId
;
if
(
hospitalid
.
HasValue
)
{
{
var
ids
=
data1
.
Select
(
t
=>
t
.
PermissionId
).
ToList
();
var
permissions
=
perforcollectpermissionRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalid
.
Value
&&
t
.
UserId
==
userid
);
var
updates
=
perforcollectpermissionRepository
.
GetEntities
(
w
=>
ids
.
Contains
(
w
.
Id
));
if
(
permissions
!=
null
&&
permissions
.
Any
())
if
(
updates
!=
null
)
perforcollectpermissionRepository
.
RemoveRange
(
permissions
.
ToArray
());
{
foreach
(
var
item
in
updates
)
{
item
.
AttachLast
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
AttachLast
;
item
.
Readnoly
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
Readnoly
;
item
.
Visible
=
data1
.
FirstOrDefault
(
w
=>
w
.
PermissionId
==
item
.
Id
).
Visible
;
}
perforcollectpermissionRepository
.
UpdateRange
(
updates
.
ToArray
());
}
}
}
// 新增
// 新增
...
@@ -209,7 +218,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
...
@@ -209,7 +218,7 @@ public void SetPermission(int userid, IEnumerable<CollectPermission> collects)
var
children
=
userRepository
.
GetEntities
(
w
=>
w
.
ParentID
==
userid
);
var
children
=
userRepository
.
GetEntities
(
w
=>
w
.
ParentID
==
userid
);
if
(
children
!=
null
&&
children
.
Any
())
users
.
AddRange
(
children
);
if
(
children
!=
null
&&
children
.
Any
())
users
.
AddRange
(
children
);
var
data2
=
collects
.
Where
(
w
=>
!
w
.
PermissionId
.
HasValue
&&
(
w
.
Visible
>
0
||
w
.
AttachLast
>
0
||
w
.
Readnoly
>
0
)
);
var
data2
=
collects
.
Where
(
w
=>
w
.
Visible
>
0
);
foreach
(
var
item
in
users
)
foreach
(
var
item
in
users
)
{
{
var
inserts
=
data2
?.
Select
(
w
=>
new
collect_permission
var
inserts
=
data2
?.
Select
(
w
=>
new
collect_permission
...
@@ -237,7 +246,11 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
...
@@ -237,7 +246,11 @@ public IEnumerable<collect_permission> GetCollectSheet(int hospitalId, int userI
if
(!
options
.
CollectRoles
.
Contains
(
userrole
.
RoleID
))
if
(!
options
.
CollectRoles
.
Contains
(
userrole
.
RoleID
))
{
{
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
;
var
types
=
new
[]
{
(
int
)
SheetType
.
OtherIncome
,
(
int
)
SheetType
.
Expend
,
(
int
)
SheetType
.
Workload
,
(
int
)
SheetType
.
SpecialUnit
};
var
sheetNames
=
exmoduleRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
&&
types
.
Contains
(
w
.
SheetType
??
0
))?.
Select
(
t
=>
t
.
ModuleName
).
ToList
()
??
new
List
<
string
>();
sheetNames
.
Add
(
"4.2 特殊核算单元绩效测算表"
);
Expression
<
Func
<
collect_permission
,
bool
>>
exp
=
(
w
)
=>
w
.
HospitalId
==
hospitalId
&&
w
.
UserId
==
userId
&&
sheetNames
.
Contains
(
w
.
SheetName
);
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
if
(!
string
.
IsNullOrEmpty
(
sheetName
))
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
exp
=
exp
.
And
(
w
=>
w
.
SheetName
==
sheetName
);
return
perforcollectpermissionRepository
.
GetEntities
(
exp
);
return
perforcollectpermissionRepository
.
GetEntities
(
exp
);
...
...
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