Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
c4d58b1e
Commit
c4d58b1e
authored
4 years ago
by
liudong1993
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的对齐视图
parent
5e75b49c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
600 additions
and
149 deletions
+600
-149
RB_OKR_Permission_ViewModel.cs
Edu.Model/ViewModel/OKR/RB_OKR_Permission_ViewModel.cs
+5
-0
OKRPeriodModule.cs
Edu.Module.OKR/OKRPeriodModule.cs
+504
-146
RB_OKR_ObjectiveRelationRepository.cs
Edu.Repository/OKR/RB_OKR_ObjectiveRelationRepository.cs
+11
-0
RB_OKR_ObjectiveRepository.cs
Edu.Repository/OKR/RB_OKR_ObjectiveRepository.cs
+53
-3
RB_OKR_PermissionRepository.cs
Edu.Repository/OKR/RB_OKR_PermissionRepository.cs
+4
-0
OKRPeriodController.cs
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
+23
-0
No files found.
Edu.Model/ViewModel/OKR/RB_OKR_Permission_ViewModel.cs
View file @
c4d58b1e
...
...
@@ -18,5 +18,10 @@ namespace Edu.Model.ViewModel.OKR
/// 来源名称
/// </summary>
public
string
SourceName
{
get
;
set
;
}
/// <summary>
/// 创建人ids
/// </summary>
public
string
CreateByIds
{
get
;
set
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Edu.Module.OKR/OKRPeriodModule.cs
View file @
c4d58b1e
...
...
@@ -1173,11 +1173,13 @@ namespace Edu.Module.OKR
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
((
","
+
deptModel
.
ManagerIds
+
","
).
Contains
(
","
+
userInfo
.
Id
+
","
))
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Dept_Id
=
userInfo
.
DeptId
});
em1List
=
em1List
.
Where
(
x
=>
!
emList
.
Select
(
y
=>
y
.
Id
)
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
UserIdList
.
Add
(
item
.
Id
);
...
...
@@ -3145,10 +3147,12 @@ namespace Edu.Module.OKR
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
((
","
+
deptModel
.
ManagerIds
+
","
).
Contains
(
","
+
userInfo
.
Id
+
","
))
{
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Dept_Id
=
userInfo
.
DeptId
});
em1List
=
em1List
.
Where
(
x
=>
!
emList
.
Select
(
y
=>
y
.
Id
)
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
ChildList
.
Add
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
...
...
@@ -3327,11 +3331,13 @@ namespace Edu.Module.OKR
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
((
","
+
deptModel
.
ManagerIds
+
","
).
Contains
(
","
+
userInfo
.
Id
+
","
))
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Dept_Id
=
userInfo
.
DeptId
});
em1List
=
em1List
.
Where
(
x
=>
!
emList
.
Select
(
y
=>
y
.
Id
)
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
ChildIdList
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
ChildIdList
.
Add
(
item
.
Id
);
...
...
@@ -3509,11 +3515,13 @@ namespace Edu.Module.OKR
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
((
","
+
deptModel
.
ManagerIds
+
","
).
Contains
(
","
+
userInfo
.
Id
+
","
))
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Dept_Id
=
userInfo
.
DeptId
});
em1List
=
em1List
.
Where
(
x
=>
!
emList
.
Select
(
y
=>
y
.
Id
)
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
UserIdList
.
Add
(
item
.
Id
);
...
...
@@ -3699,11 +3707,13 @@ namespace Edu.Module.OKR
}
}
//如果是部门主管 需要将部门下除自己其他人加入
if
((
","
+
deptModel
.
ManagerIds
+
","
).
Contains
(
","
+
userInfo
.
Id
+
","
))
//查询部门负责人 负责的所有部门
var
xjdlist
=
departmentRepository
.
GetDepartmentListRepository
(
new
Model
.
ViewModel
.
User
.
RB_Department_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ManagerIds
=
userInfo
.
Id
.
ToString
()
});
if
(
xjdlist
.
Any
())
{
//查询该部门下所有人
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
Dept_Id
=
userInfo
.
DeptId
});
em1List
=
em1List
.
Where
(
x
=>
!
emList
.
Select
(
y
=>
y
.
Id
)
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
var
em1List
=
accountRepository
.
GetEmployeeListRepository
(
new
Model
.
ViewModel
.
User
.
Employee_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
QDeptIds
=
string
.
Join
(
","
,
xjdlist
.
Select
(
x
=>
x
.
DeptId
))
});
em1List
=
em1List
.
Where
(
x
=>
!
UserIdList
.
Contains
(
x
.
Id
)
&&
x
.
DirectSupervisor
==
0
).
ToList
();
//排序 已存在的直接关系
foreach
(
var
item
in
em1List
)
{
UserIdList
.
Add
(
item
.
Id
);
...
...
@@ -3910,7 +3920,7 @@ namespace Edu.Module.OKR
/// <returns></returns>
public
object
GetOKRMyAlignView
(
int
PeriodId
,
UserInfo
userInfo
)
{
var
list
=
oKR_ObjectiveRepository
.
GetList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
CreateBy
=
userInfo
.
Id
});
var
list
=
oKR_ObjectiveRepository
.
GetList
ForEmName
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
CreateBy
=
userInfo
.
Id
});
if
(
list
.
Any
())
{
string
objectiveIds
=
string
.
Join
(
","
,
list
.
Select
(
x
=>
x
.
Id
));
...
...
@@ -3929,124 +3939,204 @@ namespace Edu.Module.OKR
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ParentIds
=
objectiveIds
});
if
(
xdqlist
.
Any
())
{
//查询下对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
Get
ParentAlignNum
(
string
.
Join
(
","
,
s
dqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
s
dqlist
)
var
rlist
=
oKR_ObjectiveRelationRepository
.
Get
ChildAlignNum
(
string
.
Join
(
","
,
x
dqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
x
dqlist
)
{
item
.
ParentNum
=
rlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
FirstOrDefault
()?.
Parent
Id
??
0
;
item
.
ChildNum
=
rlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
FirstOrDefault
()?.
Objective
Id
??
0
;
}
}
List
<
int
>
DQUserId
=
new
List
<
int
>();
string
jObjectiveIds
=
objectiveIds
;
if
(
sdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
sdqlist
.
Select
(
x
=>
x
.
CreateBy
));
}
if
(
xdqlist
.
Any
())
{
jObjectiveIds
+=
","
+
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
xdqlist
.
Select
(
x
=>
x
.
CreateBy
));
}
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
//查询是否有权限
var
pList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
2
,
ObjectiveIds
=
jObjectiveIds
});
var
pkrList
=
new
List
<
RB_OKR_Permission_ViewModel
>();
if
(
krList
.
Any
())
{
string
krIds
=
string
.
Join
(
","
,
krList
.
Select
(
x
=>
x
.
Id
));
pkrList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
3
,
ObjectiveIds
=
krIds
});
}
string
scoreRuleIds
=
string
.
Join
(
","
,
list
.
Where
(
x
=>
x
.
ScoreRuleId
>
0
).
Select
(
x
=>
x
.
ScoreRuleId
));
var
ScoreRuleList
=
new
List
<
RB_OKR_ScoreDetail_ViewModel
>();
if
(!
string
.
IsNullOrEmpty
(
scoreRuleIds
))
{
ScoreRuleList
=
oKR_ScoreDetailRepository
.
GetList
(
new
RB_OKR_ScoreDetail_ViewModel
()
{
ScoreIds
=
scoreRuleIds
});
}
foreach
(
var
item
in
krList
)
//用户周期权限
List
<
RB_OKR_Objective_ViewModel
>
UserLookList
=
new
List
<
RB_OKR_Objective_ViewModel
>();
if
(
DQUserId
.
Any
())
{
item
.
IsLock
=
2
;
if
(
pkrList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
DQUserId
=
DQUserId
.
Distinct
().
ToList
();
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
PeriodId
,
CreateByIds
=
string
.
Join
(
","
,
DQUserId
)
});
if
(
zpList
.
Any
())
{
item
.
IsLock
=
1
;
foreach
(
var
UserId
in
DQUserId
)
{
int
IsLook
=
2
;
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
IsLook
=
1
;
}
}
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
IsLook
=
1
;
}
}
UserLookList
.
Add
(
new
RB_OKR_Objective_ViewModel
()
{
CreateBy
=
UserId
,
IsLock
=
IsLook
});
}
}
}
foreach
(
var
item
in
sdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
(
item
.
IsDefaultState
==
1
)
{
item
.
IsLock
=
1
;
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
)
;
}
}
foreach
(
var
item
in
xdqlist
)
{
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
if
((
UserLookList
.
Where
(
x
=>
x
.
CreateBy
==
item
.
CreateBy
).
FirstOrDefault
()?.
IsLock
??
0
)
==
1
)
{
item
.
IsLock
=
1
;
}
}
foreach
(
var
item
in
list
)
{
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
else
{
item
.
IsLock
=
1
;
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
item
.
IsLock
=
1
;
}
}
}
}
}
}
foreach
(
var
item
in
xdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
#
region
对齐列表
var
sdqclist
=
sdqlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList
=
sdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ParentList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList
)
if
((
UserLookList
.
Where
(
x
=>
x
.
CreateBy
==
item
.
CreateBy
).
FirstOrDefault
()?.
IsLock
??
0
)
==
1
)
{
item
.
ParentList
.
Add
(
new
ObjectiveEmployeeModel
()
{
AccountId
=
qitem
,
AccountName
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
sdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
item
.
IsLock
=
1
;
}
var
xdqclist
=
xdqlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
List
<
int
>
EmIdList2
=
xdqclist
.
Select
(
x
=>
x
.
CreateBy
).
Distinct
().
ToList
();
item
.
ChildList
=
new
List
<
ObjectiveEmployeeModel
>();
foreach
(
var
qitem
in
EmIdList2
)
else
{
item
.
ChildList
.
Add
(
new
ObjectiveEmployeeModel
()
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
AccountId
=
qitem
,
AccountName
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmName
,
Icon
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
FirstOrDefault
().
EmPhoto
,
AlignList
=
xdqclist
.
Where
(
x
=>
x
.
CreateBy
==
qitem
).
ToList
()
});
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
item
.
IsLock
=
1
;
}
}
}
}
}
#
endregion
}
#
region
分数显示
item
.
ScoreName
=
""
;
item
.
ScoreColor
=
""
;
if
(
item
.
ScoreRuleId
>
0
)
foreach
(
var
item
in
list
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
var
scoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
item
.
Score
&&
x
.
ScoreMax
>=
item
.
Score
).
FirstOrDefault
();
item
.
ScoreName
=
scoreRuleModel
?.
Name
??
""
;
item
.
ScoreColor
=
scoreRuleModel
?.
Color
??
""
;
foreach
(
var
qitem
in
item
.
KeyResultList
)
{
var
qscoreRuleModel
=
ScoreRuleList
.
Where
(
x
=>
x
.
ScoreId
==
item
.
ScoreRuleId
&&
x
.
ScoreMin
<=
qitem
.
Score
&&
x
.
ScoreMax
>=
qitem
.
Score
).
FirstOrDefault
();
qitem
.
ScoreName
=
qscoreRuleModel
?.
Name
??
""
;
qitem
.
ScoreColor
=
qscoreRuleModel
?.
Color
??
""
;
}
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
#
region
对齐列表
item
.
ParentSingleList
=
sdqlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
item
.
ChildSingleList
=
xdqlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
ToList
();
#
endregion
}
}
...
...
@@ -4056,75 +4146,343 @@ namespace Edu.Module.OKR
x
.
Title
,
x
.
Sort
,
x
.
Progress
,
x
.
Weight
,
x
.
Score
,
x
.
ProgressRemark
,
x
.
IsDefaultState
,
x
.
ProgressState
,
ProgressStateName
=
x
.
ProgressState
.
ToName
(),
x
.
Status
,
x
.
IsLock
,
x
.
ScoreName
,
x
.
ScoreColor
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
x
.
EmName
,
x
.
EmPhoto
,
ParentList
=
x
.
ParentSingleList
.
Select
(
y
=>
new
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
Progress
,
z
.
Weight
,
z
.
Score
,
z
.
ProgressState
,
ProgressStateName
=
z
.
ProgressState
.
ToName
(),
z
.
StartValue
,
z
.
EndValue
,
z
.
CurrentValue
,
z
.
IsEasyMode
,
z
.
IsLock
,
z
.
ScoreName
,
z
.
ScoreColor
y
.
Id
,
Title
=
y
.
IsLock
==
1
?
""
:
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
IsLock
,
y
.
ProgressState
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ParentNum
,
y
.
EmName
,
y
.
EmPhoto
}),
ParentList
=
x
.
Parent
List
.
Select
(
y
=>
new
ChildList
=
x
.
ChildSingle
List
.
Select
(
y
=>
new
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
y
.
Id
,
Title
=
y
.
IsLock
==
1
?
""
:
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
IsLock
,
y
.
ProgressState
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ChildNum
,
y
.
EmName
,
y
.
EmPhoto
}),
});
}
/// <summary>
/// 获取我的对齐视图 再下一级
/// </summary>
/// <param name="periodId"></param>
/// <param name="objectiveId"></param>
/// <param name="type"></param>
/// <param name="userInfo"></param>
/// <returns></returns>
public
object
GetOKRMyAlignViewNext
(
int
PeriodId
,
int
objectiveId
,
int
type
,
UserInfo
userInfo
)
{
if
(
type
==
1
)
{
//查询向上对齐
var
sdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ObjectiveIds
=
objectiveId
.
ToString
()
});
if
(
sdqlist
.
Any
())
{
//查询上对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetParentAlignNum
(
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
sdqlist
)
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
item
.
ParentNum
=
rlist
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
FirstOrDefault
()?.
ParentId
??
0
;
}
}
else
{
return
new
List
<
object
>();
}
List
<
int
>
DQUserId
=
new
List
<
int
>();
string
jObjectiveIds
=
string
.
Join
(
","
,
sdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
sdqlist
.
Select
(
x
=>
x
.
CreateBy
));
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
//查询是否有权限
var
pList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
2
,
ObjectiveIds
=
jObjectiveIds
});
//用户周期权限
List
<
RB_OKR_Objective_ViewModel
>
UserLookList
=
new
List
<
RB_OKR_Objective_ViewModel
>();
if
(
DQUserId
.
Any
())
{
DQUserId
=
DQUserId
.
Distinct
().
ToList
();
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
PeriodId
,
CreateByIds
=
string
.
Join
(
","
,
DQUserId
)
});
if
(
zpList
.
Any
())
{
foreach
(
var
UserId
in
DQUserId
)
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
IsLock
}),
})
}),
ChildList
=
x
.
ChildList
.
Select
(
y
=>
new
int
IsLook
=
2
;
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
IsLook
=
1
;
}
}
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
IsLook
=
1
;
}
}
UserLookList
.
Add
(
new
RB_OKR_Objective_ViewModel
()
{
CreateBy
=
UserId
,
IsLock
=
IsLook
});
}
}
}
foreach
(
var
item
in
sdqlist
)
{
y
.
AccountId
,
y
.
AccountName
,
y
.
Icon
,
AlignList
=
y
.
AlignList
.
Select
(
q
=>
new
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
q
.
Id
,
q
.
Title
,
q
.
Sort
,
q
.
IsLock
,
KeyResultList
=
x
.
KeyResultList
.
Select
(
z
=>
new
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
if
((
UserLookList
.
Where
(
x
=>
x
.
CreateBy
==
item
.
CreateBy
).
FirstOrDefault
()?.
IsLock
??
0
)
==
1
)
{
item
.
IsLock
=
1
;
}
else
{
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
z
.
Id
,
z
.
Name
,
z
.
Sort
,
z
.
IsLock
}),
})
}),
});
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
item
.
IsLock
=
1
;
}
}
}
}
}
}
return
sdqlist
.
Select
(
y
=>
new
{
y
.
Id
,
Title
=
y
.
IsLock
==
1
?
""
:
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
IsLock
,
y
.
ProgressState
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ParentNum
,
y
.
EmName
,
y
.
EmPhoto
});
}
else
{
//查询向下对齐
var
xdqlist
=
oKR_ObjectiveRepository
.
GetParentList
(
new
RB_OKR_Objective_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PeriodId
=
PeriodId
,
ParentIds
=
objectiveId
.
ToString
()
});
if
(
xdqlist
.
Any
())
{
//查询下对齐数量
var
rlist
=
oKR_ObjectiveRelationRepository
.
GetChildAlignNum
(
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
)));
foreach
(
var
item
in
xdqlist
)
{
item
.
ChildNum
=
rlist
.
Where
(
x
=>
x
.
ParentId
==
item
.
Id
).
FirstOrDefault
()?.
ObjectiveId
??
0
;
}
}
else
{
return
new
List
<
object
>();
}
List
<
int
>
DQUserId
=
new
List
<
int
>();
string
jObjectiveIds
=
string
.
Join
(
","
,
xdqlist
.
Select
(
x
=>
x
.
Id
));
DQUserId
.
AddRange
(
xdqlist
.
Select
(
x
=>
x
.
CreateBy
));
//查询结果列表
var
krList
=
oKR_KeyResultRepository
.
GetList
(
new
RB_OKR_KeyResult_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
ObjectiveIds
=
jObjectiveIds
});
//查询是否有权限
var
pList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
2
,
ObjectiveIds
=
jObjectiveIds
});
//用户周期权限
List
<
RB_OKR_Objective_ViewModel
>
UserLookList
=
new
List
<
RB_OKR_Objective_ViewModel
>();
if
(
DQUserId
.
Any
())
{
DQUserId
=
DQUserId
.
Distinct
().
ToList
();
//查询是否有权限
var
zpList
=
oKR_PermissionRepository
.
GetList
(
new
RB_OKR_Permission_ViewModel
()
{
Group_Id
=
userInfo
.
Group_Id
,
PermissionType
=
1
,
TargetId
=
PeriodId
,
CreateByIds
=
string
.
Join
(
","
,
DQUserId
)
});
if
(
zpList
.
Any
())
{
foreach
(
var
UserId
in
DQUserId
)
{
int
IsLook
=
2
;
var
NotLookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
zpList
.
Where
(
x
=>
x
.
CreateBy
==
UserId
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
IsLook
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
IsLook
=
1
;
}
}
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
IsLook
=
1
;
}
}
UserLookList
.
Add
(
new
RB_OKR_Objective_ViewModel
()
{
CreateBy
=
UserId
,
IsLock
=
IsLook
});
}
}
}
foreach
(
var
item
in
xdqlist
)
{
//结果列表
item
.
KeyResultList
=
krList
.
Where
(
x
=>
x
.
ObjectiveId
==
item
.
Id
).
ToList
();
if
(
item
.
IsDefaultState
==
1
)
{
item
.
ProgressState
=
item
.
KeyResultList
.
Max
(
x
=>
x
.
ProgressState
);
}
if
((
UserLookList
.
Where
(
x
=>
x
.
CreateBy
==
item
.
CreateBy
).
FirstOrDefault
()?.
IsLock
??
0
)
==
1
)
{
item
.
IsLock
=
1
;
}
else
{
item
.
IsLock
=
2
;
if
(
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
).
Any
())
{
var
NotLookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
2
).
ToList
();
var
LookList
=
pList
.
Where
(
x
=>
x
.
TargetId
==
item
.
Id
&&
x
.
State
==
1
).
ToList
();
if
(
NotLookList
.
Any
())
{
//有不可看的
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
())
{
item
.
IsLock
=
1
;
}
if
(
NotLookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
item
.
IsLock
=
1
;
}
}
if
(
item
.
IsLock
==
2
)
{
if
(
LookList
.
Any
())
{
if
(
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Employee
&&
x
.
SourceId
==
userInfo
.
Id
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Post
&&
x
.
SourceId
==
userInfo
.
PostId
).
Any
()
||
LookList
.
Where
(
x
=>
x
.
Type
==
Common
.
Enum
.
OKR
.
PermissionTypeEnum
.
Department
&&
x
.
SourceId
==
userInfo
.
DeptId
).
Any
())
{
//OK
}
else
{
item
.
IsLock
=
1
;
}
}
}
}
}
}
return
xdqlist
.
Select
(
y
=>
new
{
y
.
Id
,
Title
=
y
.
IsLock
==
1
?
""
:
y
.
Title
,
y
.
Sort
,
y
.
Progress
,
y
.
IsLock
,
y
.
ProgressState
,
ProgressStateName
=
y
.
ProgressState
.
ToName
(),
y
.
ChildNum
,
y
.
EmName
,
y
.
EmPhoto
});
}
}
#
endregion
...
...
This diff is collapsed.
Click to expand it.
Edu.Repository/OKR/RB_OKR_ObjectiveRelationRepository.cs
View file @
c4d58b1e
...
...
@@ -45,5 +45,16 @@ namespace Edu.Repository.OKR
string
sql
=
$@" select ObjectiveId,COUNT(0) AS ParentId from RB_OKR_ObjectiveRelation WHERE ObjectiveId in(
{
ObjectiveIds
}
) GROUP BY ObjectiveId"
;
return
Get
<
RB_OKR_ObjectiveRelation
>(
sql
).
ToList
();
}
/// <summary>
/// 获取下对齐数量
/// </summary>
/// <param name="ObjectiveIds"></param>
/// <returns></returns>
public
List
<
RB_OKR_ObjectiveRelation
>
GetChildAlignNum
(
string
ObjectiveIds
)
{
string
sql
=
$@" select ParentId,COUNT(0) AS ObjectiveId from RB_OKR_ObjectiveRelation WHERE ParentId in(
{
ObjectiveIds
}
) GROUP BY ParentId"
;
return
Get
<
RB_OKR_ObjectiveRelation
>(
sql
).
ToList
();
}
}
}
This diff is collapsed.
Click to expand it.
Edu.Repository/OKR/RB_OKR_ObjectiveRepository.cs
View file @
c4d58b1e
...
...
@@ -127,19 +127,69 @@ namespace Edu.Repository.OKR
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ObjectiveIds
))
{
where
+=
$@" and r.
{
nameof
(
RB_OKR_ObjectiveRelation
.
ObjectiveId
)}
in(
{
demodel
.
ObjectiveIds
}
)"
;
string
sql
=
$@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.ParentId
left join rb_employee e on o.CreateBy = e.EmployeeId
where
{
where
}
order by o.Id desc"
;
return
Get
<
RB_OKR_Objective_ViewModel
>(
sql
).
ToList
();
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ParentIds
))
{
where
+=
$@" and r.
{
nameof
(
RB_OKR_ObjectiveRelation
.
ParentId
)}
in(
{
demodel
.
ParentIds
}
)"
;
}
string
sql
=
$@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.
Parent
Id
string
sql
=
$@" select o.*,r.ObjectiveId,r.ParentId,e.EmName,e.EmPhoto from RB_OKR_Objective o
inner join rb_okr_objectiverelation r on o.Id = r.
Objective
Id
left join rb_employee e on o.CreateBy = e.EmployeeId
where
{
where
}
order by o.Id desc"
;
return
Get
<
RB_OKR_Objective_ViewModel
>(
sql
).
ToList
();
}
return
new
List
<
RB_OKR_Objective_ViewModel
>();
}
public
List
<
RB_OKR_Objective_ViewModel
>
GetListForEmName
(
RB_OKR_Objective_ViewModel
demodel
)
{
string
where
=
$@" 1=1 and o.Status <>5"
;
if
(
demodel
.
Group_Id
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
Group_Id
)}
=
{
demodel
.
Group_Id
}
"
;
}
if
(
demodel
.
Id
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
Id
)}
=
{
demodel
.
Id
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
ObjectiveIds
))
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
Id
)}
in(
{
demodel
.
ObjectiveIds
}
)"
;
}
if
(
demodel
.
PeriodId
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
PeriodId
)}
=
{
demodel
.
PeriodId
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
Title
))
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
Title
)}
like '%
{
demodel
.
Title
}
%'"
;
}
if
(
demodel
.
ProgressState
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
ProgressState
)}
=
{(
int
)
demodel
.
ProgressState
}
"
;
}
if
(
demodel
.
CreateBy
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(
demodel
.
Status
>
0
)
{
where
+=
$@" and o.
{
nameof
(
RB_OKR_Objective_ViewModel
.
Status
)}
=
{
demodel
.
Status
}
"
;
}
string
sql
=
$@" select o.*,e.EmName,e.EmPhoto from RB_OKR_Objective o
left join rb_employee e on o.CreateBy = e.EmployeeId
where
{
where
}
order by o.Sort asc"
;
return
Get
<
RB_OKR_Objective_ViewModel
>(
sql
).
ToList
();
}
/// <summary>
/// 获取最大的Sort
/// </summary>
...
...
This diff is collapsed.
Click to expand it.
Edu.Repository/OKR/RB_OKR_PermissionRepository.cs
View file @
c4d58b1e
...
...
@@ -94,6 +94,10 @@ namespace Edu.Repository.OKR
{
where
+=
$@" and
{
nameof
(
RB_OKR_Permission_ViewModel
.
CreateBy
)}
=
{
demodel
.
CreateBy
}
"
;
}
if
(!
string
.
IsNullOrEmpty
(
demodel
.
CreateByIds
))
{
where
+=
$@" and
{
nameof
(
RB_OKR_Permission_ViewModel
.
CreateBy
)}
in(
{
demodel
.
CreateByIds
}
)"
;
}
string
sql
=
$@" select * from RB_OKR_Permission where
{
where
}
order by Id desc"
;
return
Get
<
RB_OKR_Permission_ViewModel
>(
sql
).
ToList
();
...
...
This diff is collapsed.
Click to expand it.
Edu.WebApi/Controllers/OKR/OKRPeriodController.cs
View file @
c4d58b1e
...
...
@@ -1186,6 +1186,29 @@ namespace Edu.WebApi.Controllers.OKR
return
ApiResult
.
Success
(
""
,
obj
);
}
/// <summary>
/// 获取我的对齐视图 再下一级
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetOKRMyAlignViewNext
()
{
var
userInfo
=
base
.
UserInfo
;
JObject
parms
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
int
PeriodId
=
parms
.
GetInt
(
"PeriodId"
,
0
);
int
ObjectiveId
=
parms
.
GetInt
(
"ObjectiveId"
,
0
);
//目标id
int
Type
=
parms
.
GetInt
(
"Type"
,
1
);
//类型 1向上 2向下
if
(
PeriodId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递周期id"
);
}
if
(
ObjectiveId
<=
0
)
{
return
ApiResult
.
ParamIsNull
(
"请传递关联目标id"
);
}
var
obj
=
okrPeriodModule
.
GetOKRMyAlignViewNext
(
PeriodId
,
ObjectiveId
,
Type
,
userInfo
);
return
ApiResult
.
Success
(
""
,
obj
);
}
#
endregion
#
region
后台管理
...
...
This diff is collapsed.
Click to expand it.
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